-
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?
-
abajanReplied on December 14, 2014 at 9: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? -
abajanReplied on December 14, 2014 at 9: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.
-
abajanReplied on December 14, 2014 at 12:24 PM
Hi again,
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:
Scenario 1
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.
Scenario 2
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.
Thanks
-
madhuriaddankiReplied on December 30, 2014 at 10:44 AM
Hello Nicholas,
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.
Regards,
Madhuri