What's New in the Form Script for Identity Manager 3.5.1

0 Likes
over 14 years ago

Introduction



What are the new features in IDM 3.5.1?



  • There is support for an onload form event. This event is triggered after all controls are instantiated but before the onload event is triggered on the controls. This is not the same as the internal script functionality; the latter is executed before the controls are instantiated. You can use this form onload event to regroup field initialization in one place instead of having pieces of script in the control's onload events.

  • A form event can now transport user data. when firing a custom event, you can use this to send custom data along. You set the data with an extra parameter on the field.fireEvent() method, in the triggered script use event.getCustomData() to access the data.

  • A form event now contains the underlying DOM event. This data is only available when a DOM event has triggered the form event. Use event.getDOMEvent() for this.

  • There is support for new events: onclick, ondblclick, onblur, onfocus, onkeypress, onmousedown, onmouseup, onmouseover, and onmouseout.

  • An array of attributes has been added to IDVault.get(). This enables the retrieval of values from a list of attributes in one round trip.

  • You can now add form printing to your form.

  • There is an extra parameter for form.interceptAction. This allows usage of an instance method, versus only a global function up until now.

  • field.getAllValues() allows access to all available values in a control, as opposed to the selected values only with field.getValues(). The returned array contains 2 sub arrays: the first has the data values, the second has the display - label - values

  • There are changes to the CheckBoxPickList, TrueFalseRadiobuttons and MVCheckbox controls. When you try to delete the last item in those controls, an item will be automatically added to those controls with data value "---" and display label "No results found. Please conduct another search." The label is, of course, dependent on the user's locale. The control will also be automatically disabled. This way we are always sure that the controls will behave correctly. You can provide for empty results in your own scripts in order to adapt this default behavior.


What Are the New Events Exposed in the Form Script API?



Starting with IDM 3.5.1, new events have been introduced:



  • form onload: This is executed before the onload events of the controls.

  • support for new events: onclick, ondblclick, onblur, onfocus, onkeypress, onmousedown, onmouseup, onmouseover, onmouseout.


Notes:



  • When a field is hidden or disabled, event triggering is stopped.

  • Event cancellation is not supported. The idea is to be able to execute scripts when an event occurs, not to control event propagation!

  • The events are supported on the input fields that make up the control, not on/over the picker buttons, such as the DatePicker, History, Object picker etc.

  • Not all controls support all events! For example, DNLookup, DNDisplay, and HTMLControl do not support any of the new events. Reason: the main field is always protected.


Workflow Form Script



WFS API




New method available for fieldsDescription

/* array */ getAllValues()


(Starting with IDM 3.5.1)
Allows access to all available values in a control, as opposed to the selected values only with field.getValues(). The returned array contains 2 sub arrays, the first with the data values, the second with the display - label - values







New method available for eventsDescription

/* any */ getCustomData()


(Starting with IDM 3.5.1)
A form event can now transport user data : when firing a custom event you can use this to send custom data along. You set the data with an extra parameter on the field.fireEvent() method, in the triggered script use event.getCustomData() to access the data.




New Examples



Adding Print Form Functionality to your Request or Approval Forms



The library is called PrintForm.js - it is included in the UA. Here are the steps you need to follow to add preview to a form:



1. Include the library in the form, adding the external script with the URL:



     ./javascript/JUICE/form/PrintForm.js


2. To open the print form when doing a submit (after data is validated), add the following to the form onload event or one of the field's onload events:



    var pf = new PrintForm();
form.interceptAction("SubmitAction", "around", pf.printFormInterceptor, pf);

3. To add a print button next to one of the fields, add this to the field's onload event:



    var ctrl = JUICE.UICtrlUtil.getControl(field.getName());
var btn = JUICE.UICtrlUtil.addButton(ctrl, "printid", "Print", "Print",
"javascript:var p = new PrintForm(); p.printFormAfterValidation(\"printid\");");

You can also use the HTML control and have it generate the print button. The Print pop-up window looks like this:





Figure 1 - Print pop-up window



Note: There is a PrintForm library available for IDM 3.5 - send me an email if you want this. The script to use this is also slightly different from what is documented here for IDM 3.5.1.

Labels:

How To-Best Practice
Comment List
Anonymous
Related Discussions
Recommended