Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Evaluate textfield with regular expression

Avatar

Level 3

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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...

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

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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...

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

Avatar

Level 3

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.