Forum
16:09
10/08/2009
Hello Tony!
I suggest very simple, but how I hope powerful editrule which could be used like
or
...
editrules:{regex:myNameEditRegEx, required:true}
The corresponding change in the code of grid.common.js is simple. One can insert for example after the line 610 the following code fragment
if( !(rqfield === false && this.isEmpty(val)) ) {
if(!edtrul.regex.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.regex + " " + edtrul.regex,""];}
}
}
The rule for the sesting of the regex type I get from here.
I create the small demo which use regex:/^(foo|bar)$/ in the 'Client' column. Only two values will be valide "foo" and "bar". To go in the inline editing mode one should use double.click.
The most problem I see in $.jgrid.edit.msg.regex string which should be localized, but http://translate.google.com can do produce the first version of the translations.
By the way if would be very nice to modify lines 131-136 of grid.inlinedit.js to permit more customization of the validation errors.
I hope that regex could reduce the requirement to use of custom edit rule.
Best regards
Oleg
12:38
Moderators
30/10/2007
Oleg,
Thank you, but I think we have too much options - this not quite good.
Also this can be done easy with custom definition - if this can be done with the custom ruler definition then there is no need to write additional one.
Thank you anyway.
Kind 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.
13:06
10/08/2009
Tony,
I agree with you that one can implement all with respect of custom verification rule, but the approach has some disadvantages.
If somebody is new in jqGrid he try to understand and use standard "predefined" features. It is good if he find out that formatter are exist. Then he look through the sandard verification rules and use one from there. Less then 30% of the user will use custom verification rule. So if you think from the point of view of new or not advanced users you will see that predefined regex formatter can has some advantages.
The feature is of course not very important, it is more cosmetical nature and just want to makes some thing to be used easier. I suggested this only after have seen some questions which can be easy solved by the formatter. It seems to me that at least 90% of custom verification rules do just test for regex.
Best regards
Oleg
13:42
Moderators
30/10/2007
Hello Oleg,
Maybe you are right, but user which can write regExp, can probably read that there is a custom fuction to do this
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.
22:46
10/08/2009
I am not sure, Tony what is the best way. Probably you are right, but on the other side if you compare the problem with the same problem of the validation plugin you will see that many people find interesting the question. They also missing the regular expression validator and find it practical (24 reputation points for the question and 48 reputation points for the solution).
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
48 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