So on this form I have a back-up PHP validation script to double check, in case JS is turned off. If one of the fields fails, it passes all of the values you typed into the form back to the fields, with an error message, so you don't have to type them all in again. That works okay with form elements but how do I set the value of this menu back to the country they selected? I am assuming I need to use jQuery to set it. Line 5 where it says "Please Select Your Country" I need to insert the country they selected there, so they don't have to select it again because their email broke the preg_match()....
The country value is being passed back as $_SESSION['tmpCountry'];
When I use the code below it puts the value back in that spot, but it isn't getting to the hidden form field... can I re-use the jQuery from above to set the hidden form field again from this PHP conditional?
How can you pass multiple values into the hidden field?
but I need to be able to pass all values selected through the autocomplete input into the hidden and then separate them with a comma and space. As my script is now it only takes the last value selected in the autocomplete into the hidden field, maybe I need to use some type of onchange event handler or something for it? I thought maybe I could use some variation of the following to get the comma and space:
// add placeholder to get the comma-and-space at the end
terms.push( "" );
this.value = terms.join( ", " );