Skip Navigation

[Resolved] Form datepicker bug "Uncaught SyntaxError: Unexpected token '

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 1 year, 3 months ago.

Author
Posts
#2670949
Date picker bug.png

I am trying to create a form with the default datepicker provided by Toolset.

hidden link

In Chrome and Internet Explorer, it works fine.

In Brave nothing seems to happen. The console says:

Uncaught SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at JSON.parse (<anonymous>)
at Object.success (date.js?ver=4.4.2:91:30)
at c (jquery.min.js?ver=3.7.1:2:25304)
at Object.fireWith [as resolveWith] (jquery.min.js?ver=3.7.1:2:26053)
at l (jquery.min.js?ver=3.7.1:2:77782)
at XMLHttpRequest.<anonymous> (jquery.min.js?ver=3.7.1:2:80265)
(anonymous) @ date.js?ver=4.4.2:91
c @ jquery.min.js?ver=3.7.1:2
fireWith @ jquery.min.js?ver=3.7.1:2
l @ jquery.min.js?ver=3.7.1:2
(anonymous) @ jquery.min.js?ver=3.7.1:2
load (async)
send @ jquery.min.js?ver=3.7.1:2
ajax @ jquery.min.js?ver=3.7.1:2
(anonymous) @ jquery-migrate.min.js?ver=3.4.1:2
e.<computed> @ jquery-migrate.min.js?ver=3.4.1:2
ce.<computed> @ jquery.min.js?ver=3.7.1:2
onSelect @ date.js?ver=4.4.2:89
_selectDate @ datepicker.min.js?ver=1.13.2:9
_selectDay @ datepicker.min.js?ver=1.13.2:9
selectDay @ datepicker.min.js?ver=1.13.2:9
dispatch @ jquery.min.js?ver=3.7.1:2
v.handle @ jquery.min.js?ver=3.7.1:2

#2670993

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2023-12-05 at 09.32.19.png

Hi there

I just installed the Brave browser to test this, but couldn't reproduce the problem.

I have a form with a date field, and was able to select a date via the datepicker without problem (screenshot).

As it doesn't happen with a vanilla install, and doesn't happen with your other browsers, I expect the problem relates to your specific configuration for the Brave browser.

#2671273

Thank you, I found the code that caused the datepicker not to work. I tried to block the WordPress dashboard for subscribers with this code:

add_action('admin_init', 'disable_dashboard');
function disable_dashboard() {
if (current_user_can('subscriber') && is_admin()) {
wp_redirect(home_url());
exit;
}
}