Thank you Michel for sharing the code for 2016 on-premises 8.1 I have tried your code for the Account Name and now I don't get the script error, but it's not allowing me to input any special character. See below: This is the code I am using: function validateAccountName(executionContext) { var pattern = /[^a-z0-9&\'"#\-\/<>]/ig; var fieldName = 'name'; var currentValue = Xrm.Page.getAttribute(fieldName).getValue(); if (pattern.test(currentValue)) { Xrm.Page.getControl(fieldName).setNotification('Invalid value, only these special characters are allowed: &\'" #-/<>'); } else { Xrm.Page.getControl(fieldName).clearNotification(); } } When I tried your code for first and last name, I still get the error. But I wonder if I need to have first and last name on the form, note that I am using the Full name composite. Additionally, should I add anything on this section?
↧