Forum


09:25

06/03/2013

Hallo Everyone,
I have a jqgrid, and in the page there are also several other fields, the request is to one filed has to be validated when i click on "Add" button in the jqgrid.
if the validation fails then the add modal dialog should not be displayed.
I wrote the validation function in beforeShowForm event for the "Add" button.
but I can not find any way to stop the add popup dilaog from displaying even after the validation falied.
Below is the partial code with which I have tried
.navGrid("#pager",
...
{closeAfterAdd: true, beforeShowForm: beforeShowFormEventForAdd, jqModal: false, width: 400, afterSubmit: afterSubmitEvent, editData: { Ext_MAC: Ext_MAC} }, //add
...);
function beforeShowFormEventForAdd(formid) {
// Validate BAN and Zip code field when a femto device is about to be added, femto device depends on existing and correctly formatted Zip and BAN
if (checkBANAndZipFileds()) { //Add Dialog will appear only if the BAN and Zip fields are in correct format
beforeShowFormEvent(formid);
MakeSerialNumberOnAddClick(formid);
}
else
//$(formid).css("display","none !important"); did not work; displayed the whole dialog with all editable columns
$(formid).hide(); // partially worked; displayed only the title caption and the submit, cancel button, rest of the form was hidden.
}
so, please help me guys with this, i need to completely stop dispalying the add popup dilaog if the validation fails.
Thanks in Advance...
09:44

Moderators
30/10/2007

Hello,
You can use the beforeInitData event. Returning false does not lunch the form.
Please look here
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
10:26

06/03/2013

tony said:
Hello,
You can use the beforeInitData event. Returning false does not lunch the form.
Please look here
Regards
Huge thanks...this is just what i needed, thanks a lot
Most Users Ever Online: 715
Currently Online:
59 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66