ActionsDev
3 replies to this thread. Most Recent
johnrob
25 Jun 2008, 10:52 am
Dynamic (Javascript?) drop down menu
Does anyone know if there is an action or a tutorial to create a hierarchy of drop down menus, where the content in drop menu 2 is dependent on what was selected in drop down 1?
I don’t want the user to submit the form until all selections are made, so does this mean it would need to be a javascript function?
Any help appreciated.
John
waltd
25 Jun 2008, 1:13 pmIt would need to be done with JavaScript. I’m not sure how you would handle this with an Action, either, because the amount of data to be entered and the free-form nature of it would overwhelm the limited UI controls in the Actions palette.
As far as making the form not submit until the entire set of choices is worked through, what I would do is observe the pickers, and make sure that each one had a valid value before enabling the submit button. The following requires Prototype.js to work.
function checkPickers(){
if($F('PickerOne') != ""
&& $F('PickerTwo') != ""
&& $F('PickerThree') != "")
return $('SubmitButton').enable();
return $('SubmitButton').disable();
}
You would call this in four places: in your body#onload, and in the onchange of each of the three pickers. Note that the pickers and your submit button need to have IDs to make this work. You will need to add these using the Extended dialog for now, as Freeway does not put them in by default.
<body onload="checkPickers()">
<select size="1" name="PickerOne" id="PickerOne" onchange="checkPickers()">
...
<select>
The first call (in the onload) would disable the picker. Each time a subsequent picker was changed, it would look to see if all three pickers had a selected option with a value. If so, it would enable the submit button. If not, it would leave it disabled.
As far as the other question goes, I’m sure there’s a way to make this easier in Freeway. I’ll keep it in the back of my head with all the other parallel processing things going on in there and let you know what comes of it.
Walter
On Jun 25, 2008, at 6:52 AM, johnrob wrote:
Does anyone know if there is an action or a tutorial to create a hierarchy of drop down menus, where the content in drop menu 2 is dependent on what was selected in drop down 1?
I don’t want the user to submit the form until all selections are made, so does this mean it would need to be a javascript function?
Any help appreciated.
John
Freeway user since 1997
swimmer35
29 Jun 2008, 10:10 pmI am looking for something similar…
I am creating a form for people to contact me - one of the pieces of info that i am asking for, is type of business… what i would like to add - is a drop down menu that activates anther when a specific business is selects.to then move over and choose a more specific type of office. can this be done???? or do I just put 2 lists - with type of office over one list
Mike B
29 Jun 2008, 10:28 pmYes it can be done but although the principal is easy it can be complicated to do and there are no actions to take the hard work out of it all and it either needs to be added in the page markup or included.
There is code for a Javascript example listed on one of the posts from this page: www.phpfreaks.com/forums/index.php?topic=148720
HTH
On Jun 30, 2008, at 12:10 AM, swimmer35 wrote:
I am looking for something similar…
I am creating a form for people to contact me - one of the pieces of info that i am asking for, is type of business… what i would like to add - is a drop down menu that activates anther when a specific business is selects.to then move over and choose a more specific type of office. can this be done???? or do I just put 2 lists - with type of office over one list
Freeway, PHP and MySQL examples