This post is based on the SugarCrm 5.5.2 codebase.
This hack will allow adding regular expression validation from module builder. It also allows the user to add custom validation error message for the field in question.
Go to Admin -> Module Builder. Open suitable package & module, then select fields in left tree.
Click on the Add field button. It will open a new tab named Edit Field.
- Enter field name, label, regular expression, regex message then press save. The new field will be created. Then edit the editview layout and add the newly created field on in editview. Save layout & deploy.
- Go to module in question to create an new or edit an existing entry to test the regex validation.
- This customization is not upgrade safe.
I will post the code changes in another posting shortly
The second part of this posting can be found here Module Builder support for Regex validation in textfield - part 2