Jump to content

Java validation


thefollower

Recommended Posts

Hey guys,

 

I have validation for my two input boxes but the javascript does not seem to do any thing about it when the input doesn't match the validation...

 

This is what i have:

 

<script language="JavaScript" type="text/javascript">
function ValidateForm1(theForm)
{
if (theForm.TextArea1.value == "")
{
   alert("Message must not be blank!");
   theForm.TextArea1.focus();
   return false;
}
var strFilter = /^[-+]?\d*\.?\d*$/;
var chkVal = theForm.HouseNumber.value;
if (!strFilter.test(chkVal))
{
   alert("Must be numbers only!");
   theForm.HouseNumber.focus();
   return false;
}
if (theForm.Subject.value.length > 100)
{
   alert("Max subject line is 25 characters and must not be blank!");
   theForm.Subject.focus();
   return false;
}
return true;
}

function ValidateForm1(theForm)
{
if (theForm.TextArea1.value == "")
{
   alert("Please enter a message!");
   theForm.TextArea1.focus();
   return false;
}
if (theForm.TextArea1.value.length > 250)
{
   alert("Please enter a message that does not exceed 250 characters this includes spaces.");
   theForm.TextArea1.focus();
   return false;
}
return true;
}
</script>

 

This is the html regarding it:

 

<input type="text" id="test" style="position:absolute;left:200px;top:0px;width:144px;font-family:Courier;font-size:19px;z-index:16" size="16" name="Subject" value="">
</div>
<textarea name="Letter" id="TextArea1" style="position:absolute;left:29px;top:27px;width:462px;height:443px;border:1px #000000 solid;z-index:0" rows="26" cols="49"></textarea>
<input type="text" id="HouseNumber" style="position:absolute;left:349px;top:670px;width:144px;font-family:Courier;font-size:19px;z-index:7" size="16" name="HouseNumber" value="">

 

Link to comment
https://forums.phpfreaks.com/topic/73214-java-validation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.