I’m looking to require the user to select the country in order to register on my site.
I made a required field for “Country” on the account registration page and made it a required field using a dropdown box.
However, the problem is when you go the the registration page, instead of the dropdown box showing blank or “Choose country…”, that dropdown box is already populated with the first country on the list which happens to be Afghanistan.
So technically, the user can skip it or forget to select their country and just submit their registration since a country is already selected and they won’t get an alert to select a country. So technically, even though it’s a required field, it won’t act like one so technically it really isn’t a required field. lol
How do I make it so that the dropdown box is either blank or shows “Choose country…” so that if they forget to select a country, the form will spit back an alert message telling them to select a country?
Hello Chuck,
We can use a code to add a blank option.Please provide url
Hey Josh, thanks for the reply.
Right now I’m, just testing out the PP Comp Theme on a subdomain http://comp.securenetpages.com/
Just wondering what that code is? BTW: Don’t mean to rush. Just wondering.
Hello Chuck,
Please check now.
Code used:
<script>
jQuery(".field_wrapper >select option:first-child").before('<option value="1"></option>');
jQuery(".field_wrapper >select option:first").attr('selected','selected');
</script>
Thanks Josh. Works fine! I appreciate the help!
You’re welcome Chuck
You must be logged in to reply to this topic.