Forum


Hello!
I came across the need to perform validation after Enter is pressed during inline edit mode.
I was surprised that this functionality is not yet working: i.e. displaying the same validation messages (or the first one), that of formedit, in an alert() box of an inlinedit case.
Maybe someone has already written such patch and would like to share so I would not be inventing a bike here?..
Thank you for revealing out the status of this part.
--
sledge
06:47

Moderators
30/10/2007

Hello,
Yes you are right. I'm at the crossroads. Inline editing module should be
rewriten entirely.
Regards
Tony
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.
02:53

Moderators
30/10/2007

Hello,
No - I do not rewrite these, but definitley will apply the editrules.
Regards.
Tony
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.
12:06

Moderators
30/10/2007

Hello,
To be a honest I do not know. Currently I'm little busy with other
project. Actually I must work - you know why.
Instead I will try to do this for 3.4 version (see Roadmap) and
not for the upcomming bug fix release.
Regards
Tony
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.
Hello, Tony and all,
Here is my contribution to the project: the working inline edit editrules validation. It colors the non-validating input text controls with pink color and alerts with the list of errors. Once alert dismissed, it focuses the caret onto the first erroneous control.
It does not proceed to post until all errors are corrected.
Enjoy and welcome any feedback. (note the commented info_dialog, due to such visualizing, the .focus() does not work afterwards).
I will improve it to validate also other type of controls (i.e. select :)) when my boss asks for it hehe 🙂
*** /.../jqGrid-3.3.1/js/grid.inlinedit.js 2008-10-14 19:06:22.000000000 +0200
--- grid.inlinedit.js 2008-12-09 14:55:51.000000000 +0100
***************
*** 63,68 ****
--- 63,75 ----
editable = $('#'+rowid,$t.grid.bDiv).attr("editable");
url = url ? url : $t.p.editurl;
if (editable==="1" && url) {
+ // leleiva: inline editrules
+ var ret=[true,"",new Array()];
+ var first_error;
+ // all depend on ret array
+ //ret[0] - success
+ //ret[1] - msg if not success
+ //ret[2] - the ids of erronous controls that will be colored pink
$('#'+rowid+" td",$t.grid.bDiv).each(function(i) {
nm = $t.p.colModel[i].name;
if ( nm !== 'cb' && nm !== 'subgrid' && $t.p.colModel[i].editable===true) {
***************
*** 88,98 ****
}
break;
}
}
}
});
if(tmp) { tmp["id"] = rowid; if(extraparam) { $.extend(tmp,extraparam);} }
! if(!$t.grid.hDiv.loading) {
$t.grid.hDiv.loading = true;
$("div.loading",$t.grid.hDiv).fadeIn("fast");
$.ajax({url:url,
--- 95,131 ----
}
break;
}
+ // leleiva: inline editrules
+ switch ($t.p.colModel[i].edittype) {
+ case "password":
+ case "text":
+ case "textarea":
+ ret_once = checkValues($("input, select>option:selected, textarea",this).val(),i,$t);
+ if (!ret_once[0]) {
+ ret[0] = false;
+ ret[1] += ret_once[1] + "\\n"; // + "<br>";
+ $("input, select>option:selected, textarea",this).css({backgroundColor: "pink"});
+ if (first_error == null)
+ first_error = $("input, select>option:selected, textarea",this);
+ } else {
+ $("input, select>option:selected, textarea",this).css({backgroundColor: ""});
+ }
+ break;
+ }
}
}
});
+ if(!ret[0]) {
+ try {
+ alert(ret[1]);
+ first_error.focus();
+ // window.setTimeout(function(){
+ // info_dialog($.jgrid.errors.errcap,ret[1],$.jgrid.edit.bClose, $t.p.imgpath);
+ // },0);
+ } catch (e) {}
+ }
if(tmp) { tmp["id"] = rowid; if(extraparam) { $.extend(tmp,extraparam);} }
! if(!$t.grid.hDiv.loading && ret[0]) {
$t.grid.hDiv.loading = true;
$("div.loading",$t.grid.hDiv).fadeIn("fast");
08:25

Moderators
30/10/2007

Hello,
You can send me the code to tony at trirand dot com.
Thank you
Regards
Tony
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.
08:39

Moderators
30/10/2007

Hello,
Your addition will be added in the next release. I need to perform some
additional test.
Thank you
Regards
Tony
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.
Most Users Ever Online: 715
Currently Online:
34 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