OpenESignForms / openesignforms

Open eSignForms is the first open source SaaS web contracting platform
https://open.esignforms.com
107 stars 50 forks source link

Allow a DropDown to drive another DropDown list #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Query from user: "A client has 85 stores in five states. I'm making a dropdown 
for choosing store numbers for a form, and 85 items in a dd seems unwieldy. Is 
there a way to select the state from a dropdown and then get just the stores in 
that state in another dropdown?"

To accomplish this in a general solution, we need a way:
1) Define a drop box with a list of values. In the above scenario, this would 
be a drop down (say with a name of StoreStates) of states to choose from. The 
values would likely be state codes such as FL, WA, CA, NY, etc.  
2) Link this StoreStates drop box with another drop box by "name 
specification", such as StoresInState${storeState}. So if FL were chosen in 
StoreStates, it would automatically link the other drop down named 
StoresInStateFL.  If WA where chosen, it would then switch to a dropdown named 
StoresInStateWA.
3) When the first drop down is rendered, add a javascript function call for the 
select onchange. On initial rendering, it must also pre-link to the correct 
second drop down based on its current value.  The javascript function would 
force a FORM SUBMIT so the esign server could retrieve the first drop down's 
value and associate the correct list for the second drop down and then show the 
same page again, but this time with the new second drop down shown.

Perhaps it's an option for all drop downs, or we can create a new type called 
LinkingDropDown that allows the specification of the first drop down and how it 
maps to the name for the second drop down. Or it may be a LinkedDropDown that 
rather than selecting a drop down to use, have it specify that it's name is 
dynamic (and thus based on the value of another field).

Original issue reported on code.google.com by yoz...@gmail.com on 24 Dec 2012 at 6:57

GoogleCodeExporter commented 9 years ago

Original comment by yoz...@gmail.com on 26 Dec 2012 at 6:49

GoogleCodeExporter commented 9 years ago
We are looking to make this a bit more general than just linking two drop 
downs. 

The idea for now will be that the first drop down can be configured to 'auto 
submit on change' so that the server knows when the drop down list has changed 
value. The second drop in this scenario will be allowed to have a dynamic drop 
down name spec, with the chosen drop down name as the "default drop down" to 
use if the dynamic name does not match a defined drop down list.  This will 
allow a drop down to choose its list irrespective of whether there's a first 
drop down on the same document that controls it.

Original comment by yoz...@gmail.com on 27 Dec 2012 at 8:06

GoogleCodeExporter commented 9 years ago
Added to 13.1.12 release.

A drop down field has an "Auto POST" box which if checked will cause changes to 
that drop down list to post the new value to the server such that that page 
will reload with all of the current values.  The controlling drop down list 
will use this value so when it changes the server will know.

Each drop down also has a dynamic drop down list name spec, allowing the list 
to use be based on the name and value combination.  The controlled drop down 
list will use this value so when the value changes in the first drop down list, 
the second drop down list will use the appropriate drop down list based on the 
name derived with the value of the first drop down list.

Original comment by yoz...@gmail.com on 29 Dec 2012 at 7:47

GoogleCodeExporter commented 9 years ago
Here's the general idea that I hope you can translate into your requirements.

Drop down box 1:  StatesWithStores with option : label mappings like:
WA : Washington
TX : Texas
MD : Maryland

Drop down boxes 2, 3 & 4: StoresWA, StoresTX and StoresMD. Each drop down 
contains the stores for that state alone, one built for each state listed in 
the StatesWithStores drop down list.

In your document, have a drop down field named like selectedStateWithStores 
that points to the drop down list StatesWithStores.  In this field, check Auto 
POST so that when this drop down value changes, the page reloads.

Have a second drop field in your document like selectedStore that points to a 
default drop down list, say StoresTX. The default is only used if the dynamic 
name doesn't map to a defined drop down list.  Set this field's dynamic drop 
down list name spec to be: Stores${selectedStateWithStores} so you'll 
essentially find drop down lists StoresWA, StoresTX or StoresMD.

Original comment by yoz...@gmail.com on 30 Dec 2012 at 7:43