Microsoft Dynamics - Part 2
Setting the OnLoad Event
The OnLoad event tells the form what scripts to run when it is initially loaded. In the “Form Properties”, look at the “Event Handlers” list.
Select the value already present and click the “Remove” button to delete it. Then click the “Add” button. This will open the “Handler Properties” window. Fill out the form as shown below:
Enter your license key surrounded by inverted commas into the text box at the bottom (For more information on license keys, see Configuration Options. Click the “OK” button. The “Event Handler” list will now look like this:
Close the “Form Properties” window.
Saving and Publishing the Form
Now the form needs to be saved and published. The ability to do that can be found in the top left of the contact form window.
Clicking the “Save” button will overwrite the default contact form. If you want to keep the default form, click “Save As” and give the form a new name.
Next, click the “Publish” button so the new form can be used.
Testing the Form
To open the new form, open the new contact page again. A first and last name are required before the other form controls can be used. Fill in a first and last name. If you have saved a new form, click the "Contact" button to show a drop-down list of your saved Contact forms.
Next, find the field “Address 1” under “Contact Information”. Click the text box. A pop up box with address fields should open as shown below. Start entering an address into the “Street 1” text box and suggestions should appear based on what has been entered.
When you choose the correct address it populates the fields as shown below:
Applying CSS Styles
It’s possible to add CSS to a form to give it a custom look. A file named “CompositeAddress” was downloaded as part of the repository download. This is a CSS file that will change how the pop up box looks in the form.
Open the form editor again and click the “Form Properties” button. Follow the steps laid out previously to add the “CompositeAddress” CSS file, this time, clicking the “Publish” button on the “Web Resource: New” window after saving the new file.
If you forget to publish at this point, it won’t be possible to do this in the form editor, as CSS files are not visible here. See previous section on how to publish the file through the Dynamics settings.
Scroll down through the text until you come across the following:
Now the “CompositeAddress” CSS will be picked up in the contact form. To test, your form should now have changed from the before to after as shown below:
Previous Steps:Adding Autoaddress to a Contact Form
Next Steps:Add CSS to Dynamics