Click here to Skip to main content
15,919,778 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need a code for validating date controls

Please find the html code which generated at runtime and original html attached:

This is my date control from generated html:
HTML
<input name="ctl00$PlaceHolderMain$SPWebPartManager$g_3c1ba10a_23ec_4ab5_b303_18f8bd7ee7e7$ctl00$gdvItinerary$ctl02$txtTravelDate" type="text" maxlength="10" id="ctl00_PlaceHolderMain_SPWebPartManager_g_3c1ba10a_23ec_4ab5_b303_18f8bd7ee7e7_ctl00_gdvItinerary_ctl02_txtTravelDate" style="width:110px;" /> 


And i want to do the validation when i leave this date control in the second row.

PS: A row will be added to the grid on a button click event which contains a date control, this date control should be validated with the date control in the previous row,

ie: Date in the first row should be less that date in the second row.

I have this pluggin :

http://www.position-relative.net/creation/formValidator/demos/demoValidators.html
Posted
Updated 25-Jun-12 20:57pm
v3
Comments
Sandeep Mewara 26-Jun-12 2:59am    
Did you try yourself?
Jaison Peter 26-Jun-12 3:02am    
see below posting

 
Share this answer
 
Comments
Jaison Peter 26-Jun-12 3:15am    
I dont want another pligin link..i want this particular plugin to work..

only the point is the validate fuction is not getting called why so?
I am calling jquery from this following control
<label>
Checks that the start date is before the end date Please enter an end date ealier
than the start date



<label for="date1">
Start Date :
</label>
<input value="9/1/2009" class="validate[dateRange[grp1]]" type="text" id="date1" />
</label>
<label>
<label for="date2">
End Date :
</label>
<input value="3/18/1985" class="validate[dateRange[grp1]]" type="text" id="date2" />


validate[dateRange[grp1]]

Note* Both fields must have the same name
</label>




But it should take validation on click on the text box but its not.


See my Script tag :

<script type="text/javascript" src="/_layouts/js/jquery-1.7.2.min.js"></script>
<script src="/_layouts/js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8">
</script>
<script src="/_layouts/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8">
</script>
<script>
jQuery(document).ready(function () {
// binds form submission and fields to the validation engine
jQuery("#formID").validationEngine();
});

function checkHELLO(field, rules, i, options) {
if (field.val() != "HELLO") {
// this allows to use i18 for the error msgs
return options.allrules.validate2fields.alertText;
}
}
</script>

Please see the files below :

http://www.position-relative.net/creation/formValidator/js/jquery.validationEngine.js
http://www.position-relative.net/creation/formValidator/js/languages/jquery.validationEngine-en.js
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900