Checkbox changing whether another field is visible or not

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a checkbox that I would like to program so the status of the checkbox
triggers whether a text box on the form is visible or not. Would this be
coded into the form, the checkbox, or text box? Also, can someone please
provide me an example of coding for this?

Thanks.
 
See http://irt.org/script/form.htm#4

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


|I have a checkbox that I would like to program so the status of the checkbox
| triggers whether a text box on the form is visible or not. Would this be
| coded into the form, the checkbox, or text box? Also, can someone please
| provide me an example of coding for this?
|
| Thanks.
 
Hi,
The best answer would depend on your target user. The simplest way would be
to add/remove the text box depending on the checkbox which you'd do like
this
<script type="text/javascript">
function showBox(a){
if(!document.getElementById)return;
document.getElementById('theTextBox').style.display=(a==true)?'block':'none';
}
</script>
Check this box to show text box <input type="checkbox" name="chk"
onclick="showBox(this.checked)">
<div id="theTextBox">
Text box here <input type="text" name="txt">
</div>

That's going to work for users in modern browsers. However it's not
perfect - if your client might have script disabled users or he's mentioned
the word accesibility post back and we'll give you a better answer.
 
Back
Top