PDA

View Full Version : display submit button if textbox is filled



mrjameer
Apr 2nd, 2007, 07:52 PM
hi,

i have 2 textboxes on a form.
i want to display a submit button, only when the two textboxes on a form is filled.otherwise display only just 2 textboxes.


how to do this.any of idea will be surely appreciated


thanks
mrjameer.

rwedge
Apr 2nd, 2007, 09:40 PM
Here's a simple example:
<script type="text/javascript">
/*<![CDATA[*/
function ck() {
val1=document.f.a.value;
val2=document.f.b.value;
if((val1)&&(val2)) document.f.button.style.display='inline';
else document.f.button.style.display='none';
}
/*]]>*/
</script>

<form name="f" id="f" method="post" action="" enctype="application/x-www-form-urlencoded">
<input type="text" name="a" id="a" value="" size="30" maxlength="300" onchange="ck()" /><br />
<input type="text" name="b" id="b" value="" size="30" maxlength="300" onchange="ck()" /><br />
<input type="submit" name="button" id="button" value="Submit" style="display: none;" />
</form>