When you create a document type there is this "validation" textarea where you can enter a regex for validating the content of the field. However I suspect it will only work on textstring and textareas - I have not really been using this feature all that much my self.
But if I understand you correctly this is where you can do it without having to resort to building your own custom property editor - There even is a "search for regular expression" option build in :)
If you need to do something more advanced than that then perhaps you should consider building a custom property editor.
I can enter in a RegEx which validates in this case an email address, however once I add the RegEx I can't then leave the email address blank when populating the CMS with data.
I was wondering if there was a easy way to only have the RegEx take effect if an email address was entered and not if left blank?
Validating an optional field
Hi,
Is there a way to apply a RegEx validation to an optional field? As whenever I apply the RegEx I can't then leave the field blank.
Thanks
Hi Jeff
When you create a document type there is this "validation" textarea where you can enter a regex for validating the content of the field. However I suspect it will only work on textstring and textareas - I have not really been using this feature all that much my self.
But if I understand you correctly this is where you can do it without having to resort to building your own custom property editor - There even is a "search for regular expression" option build in :)
If you need to do something more advanced than that then perhaps you should consider building a custom property editor.
Hope this helps.
/Jan
Hi Jan,
I can enter in a RegEx which validates in this case an email address, however once I add the RegEx I can't then leave the email address blank when populating the CMS with data.
I was wondering if there was a easy way to only have the RegEx take effect if an email address was entered and not if left blank?
Thanks
Hi Jeff,
Does changing the regex to match an empty string or an email address work?
Thanks,
Tom
Hi Jeff
What does your current regex expression look like?
I'm no regex guru myself but according to stackoverlow this should work
You can see the full post here http://stackoverflow.com/questions/5063977/regex-empty-string-or-email
Does this help?
/Jan
Hi Jan,
I have tried the suggestion from the StackOverflow question and it appears to work.
Thank you for your help, Jeff
is working on a reply...