I am looking for a neat solutions for the multiple Forms.
Have a look at the example screenshot:
There are three networks in the dropdown, AT&T, Verizon Wireless and T-Mobile.
I’ve selected ‘AT&T’ from the dropdown list and then ‘Sale Type’ radios appear.
T-Mobile network may have same Sale Type as ‘AT&T’ network but two extras Sale Type.
Majority of the text boxes from all the Sale Type are the same. For example:
Consumers will have 20 Fields and Business have 27 Fields (Extras Fields). Sim-Only will have less fields – 15 Fields (A few removed and new fields).
What is a good solution implement like this and DRY principle?
I have used jQuery with a lot of $ (‘.name’).hide(); $ (‘.name’).hide(); but it get real messy. Example:
$ (".at&t_consumer_radio").click(function(){
showSaleType("at&t_consumer");
});
function showSaleType(type) {
if (type == "at&t_consumer") {
$ ('.name').hide();
$ ('.name').hide(); and so on..
}
}
When completing the form, then I use PHP to validate it.