Great, it appears to work in the Edit mode now too. However I would like to test it on various browsers and devices to be sure before I close the ticket.
One question: it looks like you just removed the
setTimeout( delayed, 2000 );
from the Edit version, right?
Can you explain why the setTimeout is necessary for the "Create" versions of the forms, but not the "Edit" versions? As far as I understand, it just delays the execution of the JS function by 2 seconds. Why is that delay necessary for the "Create" forms?
from the Edit version, right?
===>
Yes, thats correct.
Can you explain why the setTimeout is necessary for the "Create" versions of the forms, but not the "Edit" versions? As far as I understand, it just delays the execution of the JS function by 2 seconds. Why is that delay necessary for the "Create" forms?
==>
Actually - I'm not sure as I did not added that code and I'm not aware about it. It was missing the function "delayed" on edit form so I just removed it.
If the delay is NOT included, then the Google AutoComplete suggestions fail to limit the suggestions to German addresses only on the Edit forms, so it is essential to keep the delay on the Edit forms.
I'm sorry, I don't see this ticket as resolved. I still need a resolution of how to display translatable placeholder text reliably in both languages on the edit forms, without breaking existing other solutions already provided by Toolset.
On further testing, I discovered that your solution of removing the setTimeout( delayed, 2000 ); code line broke existing working functionality, so it is not a viable solution to the ticket, I'm afraid.
On further testing, I discovered that your solution of removing the setTimeout( delayed, 2000 ); code line broke existing working functionality, so it is not a viable solution to the ticket, I'm afraid.
===>
The thing is that I did not added the setTimeout( delayed, 2000 ); function - I just added the javascript solution I shared:
Query(document).ready(function(){
var current_lang_code = jQuery('html').attr('lang');
var placeholder_title = jQuery("input[name*='post_title']");
var placeholder_location = jQuery("input[name*='wpcf-family-approximate-location']");
if(current_lang_code == 'en-GB'){
jQuery( placeholder_title ).attr("placeholder", "eg Evening babysitter, English-speaking nanny, Spanish tutor");
jQuery( placeholder_location ).attr("placeholder", "Use postcode, area, or street eg 80801 Munich, Giesing, Bahnhofstraße");
} else if (current_lang_code == 'de-DE') {
jQuery( placeholder_title ).attr("placeholder", "z.B. Abend-Babysitter, englischsprachige Nanny, Spanisch-Nachhilfelehrer");
jQuery( placeholder_location ).attr("placeholder", "PLZ, Ort oder Straße verwenden, z.B. 80801 München, Giesing, Bahnhofstraße");
}
});
If the setTimeout() is already added to your both add/edit form you should just add it accordingly.
you did add code to an existing function where it was already included in the "Post Form - New Job Ad".
I assumed that copying and pasting the same code to the Edit form would work. However, on further testing, with or without your code present for the placeholder text (which seems to work correctly, thank you!!)), it would appear that the limiting of the Google autocomplete is the thing not working reliably. It looks like if you edit the Job Ad and then go straight into the Address location field, then enter "Paris", that the autocomplete suggestions are not limiting to Germany as they should.
However, it I delete out "Paris" from the address location field, click somewhere else in the Edit form, and then go back into the address location field and enter "Paris", only German locations are displayed as required.
So it would appear that the address limiting isn't working reliably until the 2nd click in the address location field.
I created a video to show you what I mean. hidden link
Kind regards
Simon
New threads created by Minesh and linked to this one are listed below: