Hi Isomorphic,
thanks, I already had forgotten about that thread because it was a different use case.
I'll wait for it to be implemented, then.
For my TLD-usecase I did the character range trick again. It makes the validator pretty big, but once I got to enable caching for the DataSourceLoader result, this won't matter anymore.
Best regards
Blama
Announcement
Collapse
No announcement yet.
X
-
You previously asked for this and we noted it. Sorry, it hasn't been implemented yet, as it's rare use case that a regex will handle cleanly but where control over case-sensitivity is also required
Leave a comment:
-
ds.xml Validator case sensitivity (Question or Enhancement)
Hi Isomorphic,
I have this simple type I'm using for my eMail fields:
It's a simple email-address validation, which now fails for the ".berlin" TLD.Code:<SimpleType name="emailType" inheritsFrom="text"> <validators> <validator type="regexp" expression="^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]{2}|[cC][oO][mM]|[oO][rR][gG]|[nN][eE][tT]|[eE][dD][uU]|[gG][oO][vV]|[mM][iI][lL]|[bB][iI][zZ]|[iI][nN][fF][oO]|[mM][oO][bB][iI]|[nN][aA][mM][eE]|[aA][eE][rR][oO]|[aA][sS][iI][aA]|[jJ][oO][bB][sS]|[mM][uU][sS][eE][uU][mM])$"> </validator> </validators> </SimpleType>
Of course I know the regex rants
but still, if the lists gets longer and I wanted to validate against the IANA list of domains, I need it to be case insensitive - and working in serverside Java and JavaScript.Some people, when confronted with a problem, think
“I know, I'll use regular expressions.” Now they have two problems.
In Java, this would be done like this (docs), or with the also supported modifier-parameter.
But this leads to this stack trace on the client (v10.1p_2016-08-26, FF26 Dev mode):Code:expression="[B](?i)[/B]^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+(?:[a-zA-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$"
So my question is how to make this work in both environments, as JavaScript does not support inline modifiers?Code:11:44:14.760 [ERROR] [lms] 11:44:14.759:TMR9:WARN:Log:SyntaxError: invalid quantifier Stack from error.stack: isc.A.$74u.regexp.condition() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1378 [c]Validator.processValidator() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1440 Canvas.validateField() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:3637 Canvas.validateFieldAndDependencies() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:3623 FormItem.validate() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1082 FormItem._performValidateOnEditorExit() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1239 FormItem.handleEditorExit() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1237 FormItem.checkForEditorExit() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1220 [c]Class.fireCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:301 Timer._fireTimeout() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:1365 Timer.setTimeout/_6<() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:1362 com.smartgwt.client.core.JsObject$SGWT_WARN: 11:44:14.759:TMR9:WARN:Log:SyntaxError: invalid quantifier Stack from error.stack: isc.A.$74u.regexp.condition() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1378 [c]Validator.processValidator() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1440 Canvas.validateField() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:3637 Canvas.validateFieldAndDependencies() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:3623 FormItem.validate() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1082 FormItem._performValidateOnEditorExit() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1239 FormItem.handleEditorExit() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1237 FormItem.checkForEditorExit() @ lms/sc/modules/ISC_Forms.js?isc_version=v10.1p_2016-08-26.js:1220 [c]Class.fireCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:301 Timer._fireTimeout() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:1365 Timer.setTimeout/_6<() @ lms/sc/modules/ISC_Core.js?isc_version=v10.1p_2016-08-26.js:1362 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:72) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368) at java.lang.Thread.run(Unknown Source)
My suggestion would be a modifier-attribute for type="regexp"-valdidators. This would work in Java and JavaScript.
I'm using 5.1 now, but will switch to 6.0 soon.
Thank you & Best regards
BlamaTags: None
Leave a comment: