Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






beforeSubmit does not fire when I add a record

UserPost

20:53
02/08/2012


antonioberthely

New Member

posts 2

Hi, when I add a new record beforeSubmit dont work. beforeSubmit  only works when I edit records. Please helpme.

here is:

    $("#list1″).jqGrid({
        url:"/json.jsp?xaction=6&ejFiscal="+$("select[name=cmb_ejercicio]").val()+"&numOfc="+"ofc"+"&idTipo="+"1″+"&idModulo="+30,
        datatype: "json",
        colNames:['No. Oficio','Fecha de Oficio', 'Anexo', 'Nombre de quien firma', 'Cargo de quien firma','Nombre a quien se dirige','Cargo a quien se dirige','Observaciones'],
        colModel:[ {name:'noficio',index:'noficio', width:55, editable: true, editoptions:{size: 20}},
                    {name:'foficio',index:'foficio', width:90, editable: true,sorttype:'date',editoptions:{type: "date"},formatter:'date',formatoptions: {srcformat:'d/m/Y', newformat: 'd/m/Y'},
                                        editrules: {required:true, custom: true, custom_func:Validar}},
                    {name:'tanexo',index:'tanexo', width:100, editable: true, editoption:{size:50}},
                                        {name:'nfirma',index:'nfirma, invdate', width:100, editable: true, editoption:{size:50}},
                    {name:'cfirma',index:'cfirma', width:100, align:"right", editable: true, editoption:{size:50}},
                    {name:'ndirige',index:'ndirige', width:100, align:"right", editable: true, editoption:{size:50}},
                    {name:'cdirige',index:'cdirige', width:100,align:"right", editable: true, editoption:{size:50}},
                    {name:'obs',index:'obs', width:150, sortable:false, editable: true, edittype:"textarea", editoption:{rows:"2", cols:"10"}} ],
                                        

                rowNum:10,
        rowList:[10,20],
        pager: '#pager1',
        sortname: 'id',
        viewrecords: true,
        sortorder: "desc",
        editurl: "pages/fhpo/json.jsp?xaction=6&idModulo=30&idSegint=",
        caption:"Detalle" }).navGrid( '#pager1',
   {view:false,del:true,add:true,edit:true,refresh:true,search:false},
    {  
        beforeSubmit:function(postdata, formid) {
            postdata.obs=postdata.obs.replace(/s*[rn][rn t]*/g,"<br />");
            alert(postdata.obs+" "+postdata.file);
             return[true,""];
             }
        });


20:55
02/08/2012


antonioberthely

New Member

posts 2

antonioberthely said:

Hi, when I add a new record or delete record beforeSubmit dont work. beforeSubmit  only works when I edit records. Please helpme.

here is:

    $("#list1″).jqGrid({
        url:"/json.jsp?xaction=6&ejFiscal="+$("select[name=cmb_ejercicio]").val()+"&numOfc="+"ofc"+"&idTipo="+"1″+"&idModulo="+30,
        datatype: "json",
        colNames:['No. Oficio','Fecha de Oficio', 'Anexo', 'Nombre de quien firma', 'Cargo de quien firma','Nombre a quien se dirige','Cargo a quien se dirige','Observaciones'],
        colModel:[ {name:'noficio',index:'noficio', width:55, editable: true, editoptions:{size: 20}},
                    {name:'foficio',index:'foficio', width:90, editable: true,sorttype:'date',editoptions:{type: "date"},formatter:'date',formatoptions: {srcformat:'d/m/Y', newformat: 'd/m/Y'},
                                        editrules: {required:true, custom: true, custom_func:Validar}},
                    {name:'tanexo',index:'tanexo', width:100, editable: true, editoption:{size:50}},
                                        {name:'nfirma',index:'nfirma, invdate', width:100, editable: true, editoption:{size:50}},
                    {name:'cfirma',index:'cfirma', width:100, align:"right", editable: true, editoption:{size:50}},
                    {name:'ndirige',index:'ndirige', width:100, align:"right", editable: true, editoption:{size:50}},
                    {name:'cdirige',index:'cdirige', width:100,align:"right", editable: true, editoption:{size:50}},
                    {name:'obs',index:'obs', width:150, sortable:false, editable: true, edittype:"textarea", editoption:{rows:"2", cols:"10"}} ],
                                        

                rowNum:10,
        rowList:[10,20],
        pager: '#pager1',
        sortname: 'id',
        viewrecords: true,
        sortorder: "desc",
        editurl: "pages/fhpo/json.jsp?xaction=6&idModulo=30&idSegint=",
        caption:"Detalle" }).navGrid( '#pager1',
   {view:false,del:true,add:true,edit:true,refresh:true,search:false},
    {  
        beforeSubmit:function(postdata, formid) {
            postdata.obs=postdata.obs.replace(/s*[rn][rn t]*/g,"<br />");
            alert(postdata.obs+" "+postdata.file);
             return[true,""];
             }
        });



21:22
07/08/2012


JoeWhitlock

Member

posts 3

Put your beforeSubmit in the add section.  I have one in the edit and the add sections. 


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

27 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9596

Posts: 28792

Membership:

There are 10197 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7010 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information