...

View Full Version : Date validation



JohnShell
11-22-2010, 03:13 PM
Hi,

Got input boxes for begin and end dates - using JQuery for date picker calendar for each. Need to validate 2 things - 1 is that end date is => than begin date, 2 is that user enters date into begin date rather than just numbers.
I got date picker JQuery from another office where I work and can not change their parameters or code. So my input boxes allow for date picker selection or manual data entry.
The end date input box can be empty if user only inputting one day for begin date and not a range.
Also have 3 more begin/end date input box sets which are not visible until user clicks "Add Row" button - one click, one set added. Want to insure if user added row and input date then removed row (clicked "Remove Row" button) that the data entered is removed and not inserted into database.

Add & remove rows:


<script type="text/javascript">
var showing = 0;

function showAnother()
{
if ( showing <= 3 )
{
++showing;
document.getElementById("row"+showing).style.display ="";
}
if ( showing == 3)
{
alert("Maximum number of rows allowed.");
}
}
</script>

<script type="text/javascript">
function removeRow()
{
if ( showing >= 0 )
{
document.getElementById("row"+showing).style.display ="none";
showing--;
}
if ( showing == 0 )
{
return true;
}
}
</script>

Begin & end date input boxes:



<td><input style="width: 70px" type="text" id="startdate1" name="startdate1" /></td>
<td><input name="stopdate1" style="width: 70px" type="text" id="stopdate1"/></td>


Other 3 begin & end date input boxes same with names increased by one digit - startdate2/stopdate2, and so on to 4.

Thanks,

John

Philip M
11-22-2010, 05:18 PM
Have you tried using the search feature of this forum? This was covered very recently at

http://www.codingforums.com/showthread.php?t=209572 Post#7.

If the display property is set to none, then the element is actually removed from page completely, and is not available.

It is your responsibility to die() if necessary….. - PHP Manual



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum