I have a JavaScript that Validates Phone number and Postal Code. This function works for the form.
But have tried to apply it to an editable grid but nothing happens.
Because editable grids are subgrids..The Validation in on address entity and works on the address form.
But the editable grid is on the contact form as a subgrid..so i think getting the control is the main issue.
Using the concept of OOP in the JavaScript and the functionality works so the focus in on the editable grid.
function Form_onload() { // formats Phone number and fax field ValidatePhoneNumber(); Xrm.Page.getAttribute("new_phonenumber").addOnChange( ValidatePhoneNumber); Xrm.Page.getAttribute("new_faxnumber").addOnChange( ValidatePhoneNumber); //Validates Postal Code ValidatePostalCode(); Xrm.Page.getAttribute("new_postalzipcode").addOnChange(ValidatePostalCode); Xrm.Page.getAttribute("new_countryid").addOnChange(ValidatePostalCode); } // Calls the Format Phone Number method in the Main class function ValidatePhoneNumber(fieldname) { validateAndFormatPhoneNumber(fieldname); } // Calls the Format Postal code method in the Main class function ValidatePostalCode() { reformat_postalcode("new_postalzipcode", "new_countryid"); } // Clears the Province field when Country is Changed function ClearProvince() { Xrm.Page.data.entity.attributes.get("new_provincestateid").setValue(null); }
on the editable grid have added the JavaScript and also passed the schema name of the address detail. This is why i think its not connecting because its another entity.
I can rewrite JavaScript , but how can i get the control from the editable grid and validate.
*This post is locked for comments