On 8/11/06, Gary Feidt <[EMAIL PROTECTED]> wrote:
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
__
as far as i know, this should answer your question. Check if you have
included the return false in your onclick.
ANd as for initialisation. doing
private String field1="";
is not necessary.
--
Puneet