I'm trying to figure out how one would construct an HTML form that is complex. This is best illustrated by example:
Suppose I want to ask you what brand of skis you own. The choices might be:
Brand1
Brand2
Brand3
etc.
Based on the Brand you select, I want to know what model you have:
Model1
Model2
Model3
etc.
There may be many brands and many models. So if you choose Brand1, I don't want you to have to look at the Models for the other brands. So, I guess, I must be looking for some kind of tree architecture.
Any suggestions on where to go from here?
thanks,
chop
A complex input form
Moderator: General Moderators
Re: A complex input form
Is all this info and relationships in a database? If so you just need simple AJAX.
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: A complex input form
Typically you would use javascript to populate (we'll assume a select element) the 2nd dropdown when the first dropdown fires an "onChange" event. This is pretty standard procedure for automotive websites. Select a make, then a model, then a trim.
Re: A complex input form
The item categories and sub, sub categories are coming from a database. These would be used to populate the choices on the form.
Re: A complex input form
Are you familiar with AJAX? As flying_circus mentioned, each of your dropdowns should have an onChange event that will make an AJAX request to populate the next one.
Re: A complex input form
Unfortunately I am AJAX illiterate.
Re: A complex input form
Hi,check this link http://roshanbh.com.np/2008/01/populate ... d-php.html..Hope that it will help u...
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: A complex input form
You don't have to use AJAX. While AJAX will make the UI feel a bit more streamlined, it is also subject to failure by the user disabling javascript on the client side.chopWood wrote:Unfortunately I am AJAX illiterate.
When the user changes the first dropdown, an onchange event submits the form. Your site will create a new page request (reloads the page) and then the 2nd dropdown options are presented to the user.