Sharepoint 2013 Custom List Edit form Validation:not saving List Item after applying validation on PreSaveAction


I am trying to validate sharepoint custom list edit form on the basis of sharepoint  security group on PreSaveAction
my conditions are:
1-If User from 'UserGroup' than it it will ask to fill Request Descripton ,return false
2-if user from other group then it will ask to fill Response description, return false
3- if above condition fullfills then it will  return true

my code(below) is working fine for 1 and 2nd condition but fails to execute 3rd condition?

I am using the below code in script editor Web Part on Edit form.

<script type="text/javascript">
function PreSaveAction(){
   var returnval=true;
                operation: "GetGroupCollectionFromUser",
                userLoginName: $().SPServices.SPGetCurrentUser(),
                async: false,
                completefunc: function (xData, Status) {
                    $(xData.responseXML).find("Group").each(function () {
                        var groupname=$(this).attr('Name');
var itemTitle = $("textarea[title='Request Description']").val();
var response = $("textarea[title='ResponseDescription' ]").val();
if(groupname=='UserGroup' && itemTitle=='' && itemTitle.length < 1 )

            alert("Kindly fill the Request Description");
            $("textarea[title='Request Description']").attr("style", "border: solid 1px #ff4c42 !important");


if(response=='' && response.length < 1 )


            alert("Kindly fill the ResponseDescription");
            $("textarea[title='ResponseDescription']").attr("style", "border: solid 1px #ff4c42 !important");


return returnval;




May 28th, 2015 9:25pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics