It is helpful to know the UI fields validation errors prior to pressing the "Enter" key or "Save" button .In a situation where there is an error, JavaScript functions are handy in identifying the issues/validations at client side without server round trip.
I have explained how JavaScript functions can be attached to view fields and how JavaScript functions can raise alerts in case of errors when user navigates from one field to another field.
- IBase
- IBase Description
- External ID
"UIValidations" function gets the "IBase Description" field contents with "getElementById" document method and checks whether content's length is less than or equal to 10 characters , if the validation fails,then JavaScript function raises an alert.
"UIValidateNumber" function gets the "External ID" field contents with "getElementById" document method and checks whether contents are numbers or not , if the validation fails,then JavaScript function raises an alert.
UI field's ID will get generated as "component_id" "_" "Context_ndoe" "_" "Structure" "." "fieldname",so I built the UI element ID with controller component ID , context node and structure field. Example field ID will be like : C1_W1_V2_ibase_struct.descr.
I have explained client side validations using JavaScript functions with the below approaches .Alerts will be raised in case of "onblur" event (which fires when user leaves an input field).
In this approach , I first attached the JavaScipt functions to the fields in a function and called this function explicitly.
In this approach , I created a custom class ,attached the interface IF_CHTMLB_FORM_ITERATOR,
implemented method of the interface RENDER_CELL_START and assigned JavaScript functions to the event
"onclientblur" of the input field.
In ".htm" code , I created the iterator object and assigned to the config.
Execution Process(Validations) :
Screens to show how JavaScript function displays output in case of validation failure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
10 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 |