I recently got an assignment to work with Invision Power Software. My job is to create several applications. The first one needs me to create three a开发者_C百科jax-based fields, where the content of 2nd field depends on 1st, and 3rd on 3nd.
OK, it sounds complicated. How about this: I need Country / City / Province, where list of cities and provinces is dynamically loaded from database depending on previous fields.
How to create three custom dropdown fields where data for them is dynamically loaded (second field depends on first, third field depends on second)?
A general frame:
-You have 3 drop select menus A,B,C
-A is full with values, B and C are empty
-You start by putting an event on A to call a function let's call it builtDropDown()
-builtDropDown(value_selected) places appropriate values to B
-As for values going to B they could be retrieved by ajax or if they are very few the could have been preloaded and kept in a js array
-The same goes for C
This is non-ajax example you could start from: Js 3 different select menus dependend on previous selection
精彩评论