Javascript PreSaveAction() in SharePoint 2010 Validation

Go to SharePoint List Defalut Edit or Newform.aspx.

over there you have to put the HTML Form WebPart.

Inside the HTML Form Webpart you need add the following scripts tag and references.

Download js files from here  http://sputility.codeplex.com/



<script src="/Registry/JSFiles/prototype.js" type="text/javascript"></script>
<script src="/Registry/JSFiles/SPUtility.js" type="text/javascript"></script>

<script type="text/javascript">

function PreSaveAction() {
var item=SPUtility.GetSPField('Type of Report').GetValue(); // Choice filed Validation
if(item=="Informer")
{
     alert("Please select the Value");
     return false;

}
else
{
return true;
}
 }
</script>​




Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell