JavaScript Introduction :
Using JavaScript that is executed for form events, JavaScript form customization allows users to interact with entity forms.
Customizing JavaScript forms is one of several ways to manage business processes.
Programming in JavaScript Forms has the benefit of being quick and not requiring data submission.
Form programming is commonly used for the following tasks:
data Validation.
Automation.
Process improvements and enforcement.
Make use of field and form events
Scripts can be added to events such as
OnLoad
OnSave
OnChange
Tabs, on the other hand, have the event
TabStateChange
and IFRAMES have a function called
OnReadyStateComplete
EVENTS
OnLoad Event
After the form has loaded, the OnLoad event occurs. The onLoad event is used to get the data in the form ready for usage.
OnSave Event
When a form is saved, the OnSave event happens. It is not the same as the usual HTML OnSubmit event. In the following cases, the OnSave event occurs:
- When the user clicks the save button in the lower right corner of the screen.
2. The user exits the page, and there is unsaved data to be saved.
3. When auto-save is enabled and there is unsaved data on the form, 30 seconds after the data has been modified.
OnChange Event
Every field has OnChange support. Two requirements must be met for the OnChange event to occur:
- The data in the field must change.
2. The field must get disoriented.
The Two-Option (Boolean) fields have one exception. When the value is changed, the OnChange event triggers quickly without needing the user to lose focus.
If the field is modified programmatically with the setValue method, the OnChange event is not triggered. Instead, the fireOnChange method in code can be used to trigger the OnChange event.
TabStateChangeEvent Event
When a tab is enlarged or collapsed, this event occurs.
This event is necessary if you wish to use script to change the src property of an IFRAME control.
Steps to Add JavaScript as a web resource and apply customizations
- JavaScript files are used as a Web Resource to customise forms.
2. To customise the solution, go to Settings > Customizations > solution. Then, on the Solution’s left navigation pane, select Web Resources from the Components section.
To add a JavaScript file, we must first create a new Web Resource.
A new JavaScript file may be uploaded, or JavaScript code could be typed directly in CRM’s Web Resource’s Text Editor.
As a result, a new Web Resource of type JavaScript could be produced, which could subsequently be consumed on CRM Forms for customisation.
Select Form Properties on the form to register events on OnLoad events.
Select the form libraries that we wish to activate on the form level in Form Properties, as shown below.
JavaScript can be used to execute events, as shown above.
For any Help or Queries Contact us on info@crmonce.com or +918096556344.