Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Need help on jquery validationengine plugin
03/02/2011
15:22
Avatar
Nandish
Bangalore
New Member
Members
Forum Posts: 1
Member Since:
03/02/2011
sp_UserOfflineSmall Offline

Hi,

I m using jquery validationengine plugin in jqgrid to validate each fileds while adding and editing fields, its working fine but the thing is it will submit the form  please lookout this code and help me out on this

jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'server.php',
datatype: "json",
mtype: 'POST',

colNames:['Sap Id','Emp ID','Employee Name','Roles','Location','Group Name','Email'],
colModel:[
       {name:'sap_id', index:'sap_id', width:20, align:'left',
              searchoptions:{sopt:['eq', 'ne','cn','nc']},
              editable:true

              },

       {name:'emp_id', index:'emp_id', width: 40, align:'left',
              searchoptions:{sopt:['eq', 'ne','cn','nc'],searchhidden:true},hidden: true ,editrules: {edithidden:true,"class":"validate[required,custom[onlyLetterSp]] text-input"},
              editable:true,editoptions:{"class":"validate[required,custom[onlyLetterSp]] text-input"}
              },

       {name:'name', index:'name', width:50, align:'left',
              search : false,
              editable:true,editoptions:{"class":"validate[required,custom[onlyLetterSp]] text-input"}
              },

       {name:'roles', index:'roles', width:30, align:'left',
              search : false,editable:true,edittype:'custom',editoptions:{ custom_element:MultiCheckElem, custom_value:MultiCheckVal, list:'User,Manager,PMO',recreateForm: true,"class":"validate[required]"
              }},

       {name:'location', index:'location', width:20, align:'left',
                    searchoptions:{sopt:['eq', 'ne','cn','nc']},resizable:true,
              editable:true,edittype:'select',editoptions:{ value:getlocation(),
              "class":"validate[required]"}
              },

       {name:'groupname', index:'groupname', width:35, align:'left',
              search : false,resizable:true,
              editable:true,edittype:'select',editoptions:{value:getgroups(),"class":"validate[required]"}
              },

       {name:'email', index:'email', width: 35, align:'left',
              searchoptions:{sopt:['eq', 'ne','cn','nc']},
              editable:true,editoptions:{"class":"validate[required,custom[email]]"}
              },
       ],

jQuery.extend(jQuery.jgrid.edit, {
    onclickSubmit : function(params,postdata) {

              jQuery(document).ready(function(){
                           // binds form submission and fields to the validation engine
                          if(!jQuery("#FrmGrid_list").validationEngine('validate')){

                                  return false;

                          }

             });
  },

  afterComplete : function (response, postdata, formid) {

          if (postdata.oper === "add") { // highlight on "add" only
              var row = jQuery ("#"+$.jgrid.jqID(postdata.id), jQuery(this.gbox));
              row.effect("highlight", {color:"red"}, 3000);
          }
      },

  afterclickPgButtons: function(whichbutton, formid, rowid) {
          var rolename = $('#list').getCell(rowid,4)
          if(rolename ==="User") {
            document.getElementsByName("roles")[0].checked = true;
          }

          if(rolename ==="User/Manager") {
                    document.getElementsByName("roles")[0].checked = true;
                    document.getElementsByName("roles")[1].checked = true;
          }

          if(rolename==="User/Manager/PMO") {
                    document.getElementsByName("roles")[0].checked = true;
                    document.getElementsByName("roles")[1].checked = true;
                    document.getElementsByName("roles")[2].checked = true;
         }
 },

 onClose: function(params, posdata) {
      $(".formError").detach();
    },
    clearAfterAdd :false,
    closeAfterAdd: true,
    closeAfterEdit:true,
    recreateForm: true,

 });

Thanks in advacce

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
136 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information