Skip Navigation

[Resolved] JavaScript to limit datepickers & geo stopped working on some Views & Post Forms

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 54 replies, has 3 voices.

Last updated by simonM-5 3 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#2234851

HI Luo

I tested in Safari, Chrome and Firefox and confirm cases 5 and 6 are now working. Thank you. So if we get cases 7 and 8 working that would be fantastic!

Kind regards
Simon

#2234899

I have done below modifications in your website:
1) Edit the post form "Post Form - Edit Job Ad"(ID 931), in section "JS Editor", change the JS codes as below:

jQuery(document).on('cred_form_ready', function(){
  var input = 'input[name="wpcf-family-start-date[display-only]"]';
  val = jQuery(input).val();
  jQuery(input).datepicker("option", "minDate", "0").datepicker("option", "dateFormat", 'dd/mm/yy');
  jQuery(input).val(val);
});

1) Edit the post form "Post Form - Edit Nanny Ad"(ID 923), in section "JS Editor", change the JS codes as below:

jQuery(document).on('cred_form_ready', function(){
  var input = 'input[name="wpcf-nanny-available-from-date[display-only]"]';
  val = jQuery(input).val();
  jQuery(input).datepicker("option", "minDate", "0").datepicker("option", "dateFormat", 'dd/mm/yy');
  jQuery(input).val(val);
});

Please test again, check if it is fixed, thanks

#2234939
Screenshot 2021-12-02 at 10.05.22.png

Hi Luo

Unfortunately that's not working yet.

Let's look at Case 7:

1) I created a new Job Ad with title "Test JAD 05/12/2021" and selected date 05/12/2021. The correct date was displayed in the field after 1-2 seconds.
2) In field "ABOUT OUR FAMILY & WHAT WE ARE LOOKING FOR" I entered "asdf"
3) Saved the Ad
4) Clicked the Edit Job Ad button to make modifications
5) I changed the title of the Ad to "Test JAD 05/12/2021 changed to 12/12/2021"
6) Changed date to 12/12/2021. Date displayed correctly.
7) Changed "ABOUT OUR FAMILY & WHAT WE ARE LOOKING FOR" from "asdf" to "fdsa"
8) Saved
9) Clicked Edit Job Ad again to inspect the Ad.
- The title hadn't updated in the Ad itself. Bizarrely, it had been renamed (within the form) to "Test JAD 05/11/2021" ???? Where it's getting this I have no idea.
- The title of the page (which is the title of the Ad) showed the updated title.
- The field "ABOUT OUR FAMILY & WHAT WE ARE LOOKING FOR" was not updated either.

So I deleted that Ad in the back end and tried the process again from the beginning.

Now when I try to create any new Job Ad I am seeing the following error (screenshot) and cannot create any new Job Ads:

The post was not saved because of the following problem:
Invalid Form Submission (nonce failure)

Kind regards
Simon

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/new-issues-after-save-the-post/

#2235729

I assume the original questions of this thread is resolved:
https://toolset.com/forums/topic/javascript-to-limit-datepickers-geo-stopped-working-on-some-views-post-forms/#post-2131853

According to our support policy, we prefer one ticket one question:
https://toolset.com/toolset-support-policy/

For the new questions, please check the new thread here:
https://toolset.com/forums/topic/new-issues-after-save-the-post/

#2236003

Hi Luo

No, this current ticket is absolutely NOT resolved! We have no way of testing if cases 7 and 8 are working since for some inexplicable reason, we are suddenly unable to create Ads or save Ads. We have not made any changes regarding this.

In this ticket I simply reported back to you the test results after the changes you made. I appreciate you opening the ticket, and I am well aware of keeping one issue to a ticket.

Kind regards
Simon

#2237447

Hi Luo

I closed the ticket you split off from this ticket, since the error was a temporary one and not reproducible. So we still have to solve cases 7 and 8 in this ticket.

I retested case 7:
1) hidden link. I created a new Job Ad with title "Test JAD 13/12/2021" and selected date "13/12/2021". The correct date was displayed in the field after 1-2 seconds. Saved the Ad
2) hidden link. Clicked Edit Job Ad button on Ad "Test JAD 13/12/2021" to make modifications
3) Changed the title of the Ad to "Test JAD 13/12/2021 changed to 20/12/2021"
4) Changed date to "20/12/2021". Date is INCORRECT: displays the date "20/12/2001" instead of "20/12/2021".
5) All other changes are saving correctly and the error from the other ticket is no longer appearing.
6) Clicked Edit Job Ad again to inspect the Ad.
- The incorrect date "20/12/2001" instead of "20/12/2021" is being shown.

Kind regards
Simon

#2237983

I assume we are talking about post form "Post Form - Edit Job Ad":
hidden link

I have changed the JS codes as below:

jQuery(document).on('cred_form_ready', function(){
  var input = 'input[name="wpcf-family-start-date[display-only]"]';
  val = jQuery(input).val();
  jQuery(input).datepicker("option", "minDate", "0");
  jQuery(input).val(val);
});

Please test again, check if it is fixed, thanks

#2238031

Hi Luo

I retested case 7 and it works now. Thank you! I replicated similar code to "Post Form - Edit Nanny Ad" and it is now working too (case 8).

I will have my colleague retest all 8 scenarios again to double check before we can close this ticket finally.

So now hopefully you will be able to work on our other open ticket with you (https://toolset.com/forums/topic/wpv-forgot-password-form-not-working-correctly). It has been open since Oct 25 and hasn't been updated in 24 days. 😉

Kind regards
Simon

#2238653

Yes, I was working on that thread, please close this thread, and follow that ticket:
https://toolset.com/forums/topic/wpv-forgot-password-form-not-working-correctly

Thanks

#2238737

My issue is resolved now. Thank you!