Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

about validation  RSS feed

 
venki Gurram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 fields on my jsp:
start date and end date.
I have to put some validation that the startDate user enters in always less than or equal to the end date.
(I have myAction which extends ValidatorForm. I am using validation.xml to put required field check.)
 
raghavendra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi venki,

<input name="startDate" value="" size="10" class="formstyler" onFocus="this.blur()">

<input name="endDate" value="" size="10" class="formstyler" onFocus="this.blur()">

<script language="JavaScript">
<!--

----
inputedStartDate=new Date(startDate.value);
inputedEndDate=new Date(endDate.value);
datediffCur= inputedEndDate-inputedStartDate;

----
if(endDate.value==""){
alert('EndDate missed');
endDate.focus();
}
else if(endDate.value!="" && datediffCur < 0)
{
alert("End Date Cannot be Less than Start Date");
endDate.focus();
return;
}


Thanx
Raghavendra.K
 
venki Gurram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ragava,
That is nice but i am asking it in the validation frame work could u please check it
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!