Workflow and ServiceDesk Community

 View Only

Using Workflow's Built-in JavaScript Custom Event Handlers for the Checkbox Component 

Aug 06, 2010 11:19 AM

A poorly understood feature of Workflow's webform components are the Custom Event functions.  They provide basic client-side JavaScript capabilities.  Here's a quick example of how to disable editing of a textbox based upon the checked/unchecked state of a checkbox. 
 


A quick cautionary note;  before you start using any client-side scripting, make sure that you verify the data submitted by the user.  Client-side scripting provides no security or enforcement of data integrity.  It should always be treated as a convenience to the end-user.


 

  1. Open a webform
  2. Add a textbox
  3. Edit the textbox > Functionality tab > Initial value
  4. Set to bogus@bogus.com (this makes it much easier to see the disabled/enabled state of the texbox)
  5. Add a checkbox
  6. Edit the checkbox  component> Functionality tab > Custom Events > Add button
  7. Choose DisableControlIfValue
  8. Set Target Component to the textbox
  9. Set the Value to validate to on (or leave it blank for the opposite behavior)
  10. Run the debugger to test the behavior.  Toggling the checkbox should toggle the enabled/disabled state of the textbox.

A screenshot of the custom event described above:

Example of the checkbox event configuration



Here is what happens when the boxes are unchecked

Both checkboxes unchecked




Here is what happens when the boxes are checked

Both checkboxes checked







 

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.