dcsimg
Show / Hide a field depending on drop down list
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, January 30, 2007 10:19 AM

Hello, I have a form (called globalParameters) which is a 3 o 4 columns table: parameter_name - parameter_value - modify button At one point, I have on a line a drop down select line: >P> parameter_name : drop_down_list - modify button I would like the user to be able to add a new option (non existing option) to the list... As I did not know how to do it, I have added the option "ADD_NEW". So if the user selects this option, I would like a new input field to appear next to the modify button, so the user can add this option. I don't have a clue on how to do it... I have tried a few things but it does not work.    More>>

Hello,


I have a form (called globalParameters) which is a 3 o 4 columns table:


parameter_name - parameter_value - modify button


At one point, I have on a line a drop down select line:
>P>
parameter_name : drop_down_list - modify button


I would like the user to be able to add a new option (non existing option) to the list... As I did not know how to do it, I have added the option "ADD_NEW". So if the user selects this option, I would like a new input field to appear next to the modify button, so the user can add this option.


I don't have a clue on how to do it... I have tried a few things but it does not work.


Could you help me, please?

   <<Less

Re: Show / Hide a field depending on drop down list

Posted By:   Robert_Lybarger  
Posted On:   Tuesday, January 30, 2007 08:24 PM

I can't help with the exact syntax, but in roundabout terms: (1) draw the input field on the page with a known 'id' you can lookup via script later; include a style attribute that sets display to 'none' (? I believe ... or maybe sets visibility to something) if you want it to be hidden by default. (2) Add a script function (in the head or via a link rel) that, when called, checks the value of the drop-down box and compare against 'ADD_NEW' (or whatever). Based on this, look up the input field by its id and sets its style.display to 'block' (?). (3) Add an event handler to the drop-down box that calls the function in step 2.
About | Sitemap | Contact