Forum
13:17
10/08/2009
It is just a small bug in the documentation. formid is not a string like if described in the documentation. It is just jQuery object for the form. The corresponding line looks like
if( $.isFunction(rp_ge.beforeSubmit)) { ret = rp_ge.beforeSubmit(postdata,$("#"+frmgr)); }
In the same form fill be called all callback function like onInitializeForm, beforeCheckValues afterComplete, beforeShowForm, afterShowForm, beforeInitData and so on.
Somebody should just change the documentation of the wiki page /jqgridwiki/doku.php?id=wiki:form_editing. (Everyone can do it)
Regards
Oleg
Thanks, Oleg
Yes, I found the "frmgr = "FrmGrid_"+gID,frmtb = "TblGrid_"+gID" on line 236 in grid.formedit.js,
the variable "frmgr" will be passed as jQuery object ($("#frmgr")) to many functions like "beforeShowForm".
I have a question. If there are more than one grids in one page and they use the same "beforeShowForm" function, how to know the call come from gridA or gridB?
I want to distinguish them with the id or name of the form/grid, but I can't get the id or name from the parameter formid, alert(formid.id) is "undefined".
Is there any good way to get the id or name of form/gird in this function?
12:02
10/08/2009
Hi stephen!
You make very simple error. jQuery objects are a wrapper over array of DOM objects and the DOM object itself. If you use
var x = $("#blabal");
then x will be a wrapper to the arrays of DOM objects found by selector #blabal. It x.length === 0 then no elements are found. If do some elements are found, then you can access the elements with x[i].
So to display the id of the form identified by the jQuery object form you should use not the syntax alert(form.id) but alert(form[0].id):
beforeSubmit : function(postdata, form) {
alert ("in beforeSubmit formid=" + form[0].id);
}
Best regards
Oleg
Hi Oleg!
Appreciate your reply, you are right I made a mistake at this point.
The id of form is "FrmGrid_"+gridId and the name is "FormPost"(they are defined in grid.formedit.js), we can know different grid/form by the id, but I don't know why doesn't the form name have a prefix like form id? Perhaps it doesn't matter.
Anyway, thanks for your warm heart.
Thanks,
Stephen
OlegK said:
It is just a small bug in the documentation. formid is not a string like if described in the documentation. It is just jQuery object for the form. The corresponding line looks like
Somebody should just change the documentation of the wiki page /jqgridwiki/doku.php?id=wiki:form_editing. (Everyone can do it)
Regards
Oleg
Hi Oleg, I have changed this documentation.
I have replaced "the id of the form" by "the jQuery object of form id, you can use formid[0].id to get form id".
Please let me know if it is acceptable or not.
Additionally, I didn't change the description of formId in the event beforeCheckValues since it is ok.
Please let me know if anything is missing.
Thanks,
Stephen
Most Users Ever Online: 715
Currently Online:
61 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