Copy link to clipboard
Copied
I would like to create an email address that allows random lengths before and after the @ symbol.
Copy link to clipboard
Copied
If you want to make sure it includes a period in the second part use this, instead:
if (event.value) {
event.rc = /^.+@.+\..+$/.test(event.value);
}
Copy link to clipboard
Copied
You can't use an arbitrary mask for that. You need to use a custom validation script.
The most basic validation would be against the RegExp /^.+@.+$/.
Copy link to clipboard
Copied
I guess I should have been more specific. I was wanting to create a field with a script that would validate and email address of random length. i.e., verifying _________@_____.____ where the underline areas are any character/length and the "@" and "." are known and expected for validation. Thanks. Not sure how to implement RegExp /^.+@.+$/
Copy link to clipboard
Copied
I understood that, and the RegExp I provided will do it.
Use this code as your field's custom validation script:
if (event.value) {
event.rc = /^.+@.+$/.test(event.value);
}
Copy link to clipboard
Copied
If you want to make sure it includes a period in the second part use this, instead:
if (event.value) {
event.rc = /^.+@.+\..+$/.test(event.value);
}
Copy link to clipboard
Copied
Thanks for this.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now