This topic is locked

Hide or display a field based on the value of another field

6/23/2009 9:39:10 AM
PHPRunner General questions
K
kplunkert author

I would like to hide or display a field based on the value in another field.
My example:

I have a list box with Phone, Fax, Email, Postal mail as valid choices.
If the email option is selected, I would like and email address field to be displayed or the value prompted for in a pop up box.
Is either of these options do able.
KJ Plunkert

F
fbrashich 6/23/2009

I would like to hide or display a field based on the value in another field.

My example:

I have a list box with Phone, Fax, Email, Postal mail as valid choices.
If the email option is selected, I would like and email address field to be displayed or the value prompted for in a pop up box.
Is either of these options do able.
KJ Plunkert


Try this for hide/show fields i'm using it in some pages to control selections.
To HIDE: This can be used in a function o in the middle of edit controls, to switch of them at the moment of display the page for the first time.

<script>

document.forms.editform.value_t_35.style.display='none';

document.forms.editform.value_t_37.style.display='none';

document.forms.editform.value_t_39.style.display='none';

document.forms.editform.value_t_41.style.display='none';

document.forms.editform.value_t_43.style.display='none';

document.forms.editform.value_t_45.style.display='none';

</SCRIPT>
To SHOW: This must be in the bottom of the page, in HTML Mode in Visual Editor...

<script>

document.forms.editform.value_t_35.style.display='';

document.forms.editform.value_t_37.style.display='';

document.forms.editform.value_t_39.style.display='';

document.forms.editform.value_t_41.style.display='';

document.forms.editform.value_t_43.style.display='';

document.forms.editform.value_t_45.style.display='';
document.forms.editform.value_t_35.value='0';

document.forms.editform.value_t_37.value='0';

document.forms.editform.value_t_39.value='0';

document.forms.editform.value_t_41.value='0';

document.forms.editform.value_t_43.value='0';

document.forms.editform.value_t_45.value='0';

</SCRIPT>

</BODY></HTML>
I hope be usefull...
See ya!