centenial
07-21-2006, 10:13 PM
Hi,
I have this code:
function validate_form ( ) {
valid = true;
if ( document.listing.l_id.value == "" ) {
alert ( "Please enter a Listing ID!" );
valid = false;
}
if ( document.listing.a_id.selectedIndex == 0) {
alert ( "Please select an Agent!" );
valid = false;
}
if ( document.listing.category.selectedIndex == 0) {
alert ( "Please select an Category!" );
valid = false;
}
if ( document.listing.price.value == "" ) {
alert ( "Please enter a Price!" );
valid = false;
}
if ( document.listing.price_range.selectedIndex == 0) {
alert ( "Please select a Price Range!" );
valid = false;
}
if ( document.listing.town.selectedIndex == 0) {
alert ( "Please select a Town!" );
valid = false;
}
return valid;
}
I just want to add one last piece, which would do this:
if (valid == "true") {
alert ( "The Form Validated Successfully!" )
}
For some reason that isn't working... can anyone help please?
I have this code:
function validate_form ( ) {
valid = true;
if ( document.listing.l_id.value == "" ) {
alert ( "Please enter a Listing ID!" );
valid = false;
}
if ( document.listing.a_id.selectedIndex == 0) {
alert ( "Please select an Agent!" );
valid = false;
}
if ( document.listing.category.selectedIndex == 0) {
alert ( "Please select an Category!" );
valid = false;
}
if ( document.listing.price.value == "" ) {
alert ( "Please enter a Price!" );
valid = false;
}
if ( document.listing.price_range.selectedIndex == 0) {
alert ( "Please select a Price Range!" );
valid = false;
}
if ( document.listing.town.selectedIndex == 0) {
alert ( "Please select a Town!" );
valid = false;
}
return valid;
}
I just want to add one last piece, which would do this:
if (valid == "true") {
alert ( "The Form Validated Successfully!" )
}
For some reason that isn't working... can anyone help please?