I am using PreSaveAction() JavaScript function to check whether start day is lower than End day or not. If it is lower than greater than end day then it will show an alert message;
Add in the Content Editor Web Part located under the Media and Content category.
Paste the following code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict();
function PreSaveAction() {
var startDay= j(":input[title='Start_Day']").val();
var endDay= j(":input[title='End_Day']").val();
if(startDay=='')
{
alert("Please enter start day");
return false;
}
else if(endDay=='')
{
alert("Please enter end day");
return false;
}
else if(endDay < startDay)
{
alert("End day should be greater than start day");
return false;
}
else{
return true;
}
}
</script>
thank you..
Add in the Content Editor Web Part located under the Media and Content category.
Paste the following code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
var j = jQuery.noConflict();
function PreSaveAction() {
var startDay= j(":input[title='Start_Day']").val();
var endDay= j(":input[title='End_Day']").val();
if(startDay=='')
{
alert("Please enter start day");
return false;
}
else if(endDay=='')
{
alert("Please enter end day");
return false;
}
else if(endDay < startDay)
{
alert("End day should be greater than start day");
return false;
}
else{
return true;
}
}
</script>
thank you..
No comments:
Post a Comment