Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Validate form fields using javascript on jsp page

450637Oct 2 2006
I am trying to validate form fields on a jsp page using javascript. When I try to use the code below, it gives me an error that the field is undefined and never goes into the javascript. Is there something that has to be set for the javascript to get the field values, or is the syntax different for jsp than other languages (i.e. Coldfusion - html)???

<form name="form_data" action="form_data_save.jsp" method="get" onSubmit="return check_data();">

function check_data()
{
if(document.form_data.need_date.value= "")
{
alert("You must enter a date");
return false;
}
else
{
return true;
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2006
Added on Oct 2 2006
0 comments
465 views