- madhuriaddankiAsked on December 14, 2014 at 12:40 AM
The address field in my form needs to be required but I want the State/Province field of the Address to be optional. How can I do that?
- JotForm SupportabajanAnswered on December 14, 2014 at 09:17 AM
My tests have indicated that if an address field is set to required, its State/Province "sub-field" (like the second line of the address) can be left unfilled by the user, and the form submitted. If you want to remove the State/Province sub-field, click the address field and then the Fields button in the toolbar at the top of the form builder and un-ckeck State, as shown below:
Is this what you wanted to do?
- JotForm SupportabajanAnswered on December 14, 2014 at 09:32 AM
My apologies. Further tests have indicated that a jotform cannot be submitted if the State/Province "sub-field" of an address field is left unfilled. I'm actually getting inconsistent results because it seems that under some circumstances it can be left unfilled and under others it can't. I'll need to run more tests to see if I can figure out what's going on and then submit a ticket.
- JotForm SupportabajanAnswered on December 14, 2014 at 12:24 PM
Further tests have indicated that while the behavior of the State/Province field is somewhat like that of the "Street Address Line 2" one, there are some differences:
With the address field empty, if you click the Street Address Line 2 sub-field and then click away from it, nothing happens (which is the correct behavior because that sub-field is optional) but if the same action is taken with the State/Province sub-field (which I believe is also meant to be optional), the This field is required error is triggered:
If at this point all of the other sub-fields are completed (or all but Street Address Line 2) and then you click away from the address field, the error message will go away. If instead of just clicking away from the address field (or clicking another field) a submission were to be attempted, the submission would be successful.
If all but the State/Province sub-field are filled (or all but Address Line 2 and State/Province) no error message will be triggered and you will be able to submit the form in the usual manner.
So, although I'm not 100% certain, it appears that the State/Province sub-field is just as optional as the second line of the address. It's just that the former unnecessarily triggers the error message. When I stated in my last reply that the jotform could not be submitted without the State/Province sub-field filled, it's possible that no country selection was made and I didn't realize it.
I've submitted a ticket requesting that the State/Province sub-field work just like the Address Line 2 one but until the issue is resolved, I would suggest that the State/Province sub-field be hidden using the procedure earlier mentioned. You could always add a separate State/Province field to the form.
- madhuriaddankiAnswered on December 30, 2014 at 10:44 AM
Thanks for your response. I don't want the state/province field to be optional for American and Canadian addresses. If the Address fields work such that the state/province field is optional for the European addresses then that would work for me.
- ShadaeAnswered on December 30, 2014 at 11:17 AM
That is currently how the State/Province field works. If the US or Canada is select, you will get the field is required error.
Other wise it can be left blank
Please feel free to contact us if you need further assistance.