Setting up code event
To validate a data from a dropdown selection, you must set up the event parameter in code event and map it to the code group.
- Select Code maintenance > Code event.
- Click New.
-
Specify this information:
- Description
- Provide a description for the code event.
- CodeGroup
- Specify a name for the code group.
- Event parameter
- Specify the event parameter for the code group. Here are the
samples of event parameters: Sample regex for email validation:
{"CommunicationText" : {"RegEx" : "^(([^<>()\\[\\]\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$","ErrorMessage": "ValidationError_InvalidEmail"}}
Note: You can modify the default regex according to your business needs.Sample format for phone validation:{ "Phone" : {"Format": ["+01-nnn-nnn-nnnn"]} }
If the phone format is based on the selected country, no user define format must be set. When creating a phone format, ensure that the number of characters complies with the number of characters required by M3. n represents the number between 0 to 9, while M3 validates the length depending on the number of n in the format. To create a phone format, you can also add a plus sign (+), left and right brackets (), or a dash (-) as shown in this example:
"<FieldName>": {"Format": ["+(420)-nnn-nnn-nnnn",”+(nn)-nnn-nnn”]}
To have a validation, <FieldName> must be replaced with the correct field.
-
Click Save.
Note: You must update the code event parameters every time a new language is created.