Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Edit Form - relational select menus
16/07/2010
00:51
Avatar
gyrofly
Member
Members
Forum Posts: 5
Member Since:
15/07/2010
sp_UserOfflineSmall Offline

Inside our Edit Form, we have one field (edittype=select) that must dynamically update options available based on the realtime selection value of another field (edittype=select).

For example if "Hair Color" was selected in the first select menu, the values in the second menu would auto-populate with options of "Brown", "Blond" and "Brunette". If "Fruit" was selected in the first menu, the second menu would re-populate with options "Orange", "Apple", "Pear".

How would we go about this?

16/07/2010
03:01
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

If i were trying to solve this problem i would ...

1) populate the second SELECT with all possible values (eg. all hair colours, all shirt sizes, etc.)

2) attach a function call to the onchange event of the first SELECT

3) in this function, i would loop through all OPTION's in the second SELECT, and make them either hidden or visible, depending on the value of the first select

Maybe theres a better way, just an idea 🙂 I hope it helps!

Cheers,

Michael

16/07/2010
19:02
Avatar
gyrofly
Member
Members
Forum Posts: 5
Member Since:
15/07/2010
sp_UserOfflineSmall Offline

The challenge with that approach is the sheer number of options. We have literally thousands of potential values for that second SELECT. If we could pull those in ajax in some fashion with an onChange on the first SELECT that would be ideal.

Any ideas how we would do that?

18/07/2010
01:25
Avatar
michaelg
Member
Members
Forum Posts: 51
Member Since:
10/04/2010
sp_UserOfflineSmall Offline

Yep I think your right, if the number of OPTIONs is huge, then it would be best to load them via AJAX when needed.

It would be even better if you prevent loading the OPTIONs a second time if they've already been loaded.

Perhaps, it would be easiest to ...

a) Have a seperate SELECT for each of the different types, and hide/unhide the whole select depending on what is selected in the first SELECT

b) When your un-hiding one of these SELECTs, you could check if it has already been loaded,and if not then load it up via AJAX

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
57 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information