Add an onclick="validateForm(); return false;"
Then create a javascript function:
<script language="JavaScript">
function validateForm() {
var errorString = "The following field(s) may not be left
blank:\r\n\r\n";
var strField = "";
if (document.frmTest.txtFirstName.value.length == 0) {
strField += " - First Name\n";
}
if (document.frmTest.txtLastName.value.length == 0) {
strField += " - Last Name\n";
}
if (document.frmTest.txtPhone.value.length == 0) {
strField += " - Phone Number\n";
}
if (strField.length > 0) {
alert(errorString + strField);
}
} else {
document.frmTest.submit();
}
</script>
Gary
>>> [EMAIL PROTECTED] 8/11/2006 6:15:19 AM >>>
hai
i am working in struts1.1
i have threee fields in <html:text>
how to check these empty fields when submitting the submit button using
java script
its very uergent
with kindly regards
gomes
_______________________________________________________________
Confidentiality Statement:
This email/fax, including attachments, may include confidential
and/or proprietary information and may be used only by the
person or entity to which it is addressed. If the reader of
this email/fax is not the intended recipient or his or her
agent, the reader is hereby notified that any dissemination,
distribution or copying of this email/fax is prohibited. If you
have received this email/fax in error, please notify the sender
by replying to this message and deleting this email or
destroying this facsimile immediately.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]