npala2001
08-02-2006, 07:37 PM
Hi guys I am new to javascript!
I have three fields that I want validated on a form. Item3 cannot be smaller than Item2 and Item2 cannot be smaller than Item1.
Below is what I had in mind:
Function validateForm()
{
If (Item3 < Item2)
alert="You must enter a bigger size for Item 3"
else
If (Item2 < Item1)
alert="You must enter a bigger size for Item 2
}
</script>
<form method="POST" action="Post.jsp" onsubmit="validateForm(this)">
I have three fields that I want validated on a form. Item3 cannot be smaller than Item2 and Item2 cannot be smaller than Item1.
Below is what I had in mind:
Function validateForm()
{
If (Item3 < Item2)
alert="You must enter a bigger size for Item 3"
else
If (Item2 < Item1)
alert="You must enter a bigger size for Item 2
}
</script>
<form method="POST" action="Post.jsp" onsubmit="validateForm(this)">