Skip to main content
JoseBerciano
Level 3
Oct 16, 2015 2:29 AM UTC
Solved

Evaluate textfield with regular expression

Hi there,

I am trying to do something very simple, just evaluate if a textfield matches a regular expression directly from the dialog (I guess is the easiest way to do it).

So, in previous versions (CQ5) I just set up two properties to a cq:Widget which are:

regex: /((?:https?\:\/\/)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*)/i

regexText: Enter a valid URL

Then I was moved to AEM 6, and these properties do not seem to work anymore with the new Touch UI. I tried to find unsuccessfully documentation about it, and finally I ended here.

Any suggestion? Thank you in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Oct 16, 2015 2:29 AM UTC

Touch UI types are based on Granite APIs. Completely different from Classic UI types. 

Here is the documentation for the TextField:

http://docs.adobe.com/docs/en/aem/6-0/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/textfield/index.html

Also - see the developer guide:

http://docs.adobe.com/content/docs/en/aem/6-0/develop/ref/coral-ui/docs/2.1.2-aem600-015/index.html

2 replies

JoseBerciano
Level 3
Oct 16, 2015 2:29 AM UTC

Thank so much for you help. Unfortunately I could not find any property or something useful in those webpages to implement the functionality I would like to have in my component.

Any idea of how could I do this? I guess it has to be something very straightforward because is a general behaviour but I did not find any comment of someone asking for it.

So, what I want to do is not allow the user to set an invalid URL format inside a textfield component, eg: "http://www.adobe.com" would be an accepted url, "www.adobe" an incorrect one. 

Regards.

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Oct 16, 2015 2:29 AM UTC

Touch UI types are based on Granite APIs. Completely different from Classic UI types. 

Here is the documentation for the TextField:

http://docs.adobe.com/docs/en/aem/6-0/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/textfield/index.html

Also - see the developer guide:

http://docs.adobe.com/content/docs/en/aem/6-0/develop/ref/coral-ui/docs/2.1.2-aem600-015/index.html

Translate