Tuesday, October 27, 2015

PreSaveAction Javascript validation in newform.aspx Page

In this below script, PreSaveAction Javascript validation using SharePoint, Javascript and html

PreSaveAction Javascript validation

Add the script editor webpart.

Add the below code:

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">

<script type="text/javascript">
function PreSaveAction(){
  var txtnumber = $('input[title="num_Phone"]').val();

   if (!isNaN(txtnumber)){      
   alert("Please enter a Number only");
$('input[title="num_Phone"]').focus();
   return false;
}

else{
   return true;
    }
 }
</script>

No comments:

Post a Comment