Using JS Event Handlers
Using JS Event Handlers
JavaScript event handlers can be used to handle the user input for the custom HTML content. These event handlers have full access to the Web Central JavaScript API, and can be used to:
- Initialize custom HTML field values
- Copy data from custom HTML fields into standard fields and vice versa
- Create custom restrictions that use standard and/or custom HTML fields
- Save custom HTML field values to the database using workflow
Sometimes it is required to display one of the form fields in a non-standard
fashion, while still using the default form functionality (refresh/save/delete/add
new). This can be done by using two
field
elements
for the same database field:
- Regular field element with hidden attribute will ensure that the form retrieves the database field value on load and can save the changed value back to the database.
- Custom HTML field will be actually displayed.
- JS event handler will copy the hidden field value into the custom HTML field when the form is loaded .
- JS event handler will copy the custom HTML field value into the hidden field before the form is saved.
The custom HTML content can also be used as a placeholder for advanced
user interface controls created "on the fly". The view can include
custom (and/or third-party) JS functions that will add dynamic content
to the static placeholder.
The JS functions can call workflow rules to obtain the data required to display the custom control, and to save the user input to the database. This technique is used to create Web Central Timeline control, and can also be used for other types of controls such as pure HTML/CSS/Java Script controls or ActiveX objects.