How can I make a webform so when a user selects the country US it will show the states in a list with a mandatory select from list and when other countries it will show Province as textedit also mandatory.. i don't want to mess arround with Jquery and hide the controls resulting into multiple fields
2 Answers
If you're not fond of installing a pretty big module as location, have a look at conditional fields which allows you to do what you need.
Conditional Fields allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing and displayed if the state of the “dependee” field matches the right condition. You can, for example, define a custom “Article teaser" field that is shown only if a "Has teaser" checkbox is checked.
So set up a select list of counties and if US is selected show the "states list" that would be hidden otherwise.
addressfield module does that perfectly.
What I don't like about it is that it will also show "address 1&2" fields. You can hide those with css. When you output the field it will show the complete address. You can also hide the parts you don't need with css.
-
-
bummer ;-) Try the location module. There was a bug in that module when you switched countries but I heard they recently fixed it.– uweCommented Oct 24, 2011 at 20:39