开发者

One or multiple forms for chained select boxes?

开发者 https://www.devze.com 2022-12-22 14:25 出处:网络
I want to implement chained select 开发者_开发问答boxes: the first select box determines the values in the second select box. I want this to work in plain HTML first, and add Javascript later.

I want to implement chained select 开发者_开发问答boxes: the first select box determines the values in the second select box. I want this to work in plain HTML first, and add Javascript later.

Should I have both select boxes in one form tag, or have two seperate forms on one page, each with a select box?


If you want to send and retrieve all selected values at once, put them in the same form. If you want to send and retrieve only one at once, put them in separate forms. Simple as that.


One form (at least on the initial page).

Either:

  • with only one select by default (which is submitted to the server, which returns a new form with a hidden input replacing the first select and a second select chosen based on the option selected) progressively enhanced to generate new selects when options are picked.
  • with all the selects in the form, with instructions about which one users should use based on their first answer, progressively enhanced with JS to hide them all (except the first) and then reveal them based on the options picked.


whatever is more convenient for you. Not realy software related

0

精彩评论

暂无评论...
验证码 换一张
取 消