Cabadam
09-02-2003, 04:20 PM
OK, couldn't find any references really on this so here I am.
I have a form with which I want to add event handlers for the onChange event to three edit fields. Right now I am just working with the first one.
<script language="JavaScript">
function onNameChange()
{
}
function onRoomChange()
{
}
function onEmailChange()
{
}
</script>
<form action="snipped" method="post" name="form1">
<table width="100%" border="0">
<tr>
<td width="11%">Name:</td>
<td width="89%"><input type="text" name="name" onChange="onNameChange"></td>
</tr>
<tr>
<td>Room No:</td>
<td><input name="room" type="text" onChange="onRoomChange"></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input type="text" name="email" onChange="onEmailChange"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
<td> </td>
</tr>
</table>
</form>
What I want to happen is I want to validate text in the text field and if it is invalid, grey out/disable the submit button. Is this possible in javascript?
Thanks
I have a form with which I want to add event handlers for the onChange event to three edit fields. Right now I am just working with the first one.
<script language="JavaScript">
function onNameChange()
{
}
function onRoomChange()
{
}
function onEmailChange()
{
}
</script>
<form action="snipped" method="post" name="form1">
<table width="100%" border="0">
<tr>
<td width="11%">Name:</td>
<td width="89%"><input type="text" name="name" onChange="onNameChange"></td>
</tr>
<tr>
<td>Room No:</td>
<td><input name="room" type="text" onChange="onRoomChange"></td>
</tr>
<tr>
<td>Email Address:</td>
<td><input type="text" name="email" onChange="onEmailChange"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"></td>
<td> </td>
</tr>
</table>
</form>
What I want to happen is I want to validate text in the text field and if it is invalid, grey out/disable the submit button. Is this possible in javascript?
Thanks