Workflow Soluiton

 View Only
Expand all | Collapse all

Looking for a way to dither (disable) components in a form.

  • 1.  Looking for a way to dither (disable) components in a form.

    Posted Jul 22, 2010 07:55 PM
    I'm well aware of workflow's ability to make components visible/not visible, but I'd like to simply disable the component instead of taking it away all together.  Of course making an image of a dithered/disabled component visible and the actual component not visible is a solution, it is a very ugly and unsatisfactory one in my opinion.  Even though I'm almost certain this cannot be done strictly using workflow, it seems that it should be very possible with the help of some javascript.  Can anyone provide some insight or even a script that will make this functionality possible?


  • 2.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 01:13 AM

    When I've wanted to experiment with components within a form without losing my work, I came up with a workaround.  It might fit your needs:

    1. Place a true/false rule (hardcoded to always evaluate to true) before your webform. 
    2. Copy the existing webform component onto the canvas
    3. Connect a webform to the output of each path from the rule component
    4. Experiment on your copied webform
    5. Once you are done, delete the rule and uneeded webform


  • 3.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 09:32 AM
    Scott, I think he may be referring to form controls such as text boxes or radio buttons and not the entire form.  I don't have anything to contribute on that front, but I'm definitely going to take your approach when I'm testing new workflows -- that's a great idea!


  • 4.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 10:17 AM
    You are correct that I am refering to items such as text boxes, drop downs, list boxes, check boxes, etc.


  • 5.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 11:10 AM
    If your intent isn't experimentation, but instead to show the user controls that they can't manipulate, then there's another possible answer:

    On some form components (such as the textbox) you can set them to read-only.  If you combined this with a custom theme Control Style (create a new textbox stye and set its background color to grey or a grey background image)  to change the component's appearance, you might be able simulate what you are looking for. 


  • 6.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 11:46 AM
    I agree that this could work for some components, but this requires doing exactly what I don't want to do--creating duplicate user controls and changing their visibility based on whatever the dithering keys off of.  Is there anyone with experience manipulating user controls with JavaScript in the workflow?


  • 7.  RE: Looking for a way to dither (disable) components in a form.
    Best Answer

    Posted Jul 23, 2010 12:51 PM
      |   view attached
    Hi beamer7296,

    If you are just looking to disable the controls based on a value of another control you can use the Custom Events under the Functionality tab. Take a look at the sample package that I've attached and double-click on the Disable Controls check box control and look at the Custom Events configured. If you want to disable controls before going into the form you'll have to add a few more events and make the logic the opposite. Let me know if this is what you were looking for.

    Aryanos

    Attachment(s)

    zip
    Form Controls Example.zip   932 KB 1 version


  • 8.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 01:09 PM
    This is exactly what I was looking for!  Thanks!


  • 9.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 01:21 PM
    How did you know what value to place in the Value To Validate field?  Writing "on" in that field doesn't strike me as intuitive, but it makes sense that the values for the checkbox or radio button would be "on" and "off."  Is there somewhere with some more documentation?


  • 10.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 01:28 PM
    So, I took another look at the JavaScript capabilities in the current shipping product (I've just recently returned to doing Workflow dev, had to stop for a year), there is now a built-in function that should accomplish what you are asking for (read-only, grayed-out).  The usage is a a little confusing, you need to define the Custom Event on the controlling form component.

    So if you want a textbox to be disabled until you select an item from a dropdown, then:
    1. Edit the Drop Down component
    2. Add a Custom Event of "DisableControlIfValueisNullOrEmpty"
    3. When prompted, select the Textbox as the target component.
    Don't forget to define validation for each form component.  Client-side JavaScript can be easily disabled in the browser, there's no protection on the server-side if the user tries to submit bogus combinations of data.


    If this still doesn't meet your needs, then I do remember this about writing custom java script functions.
    1. Store your JavaScript functions in the form object itself (right-click the form background > Edit Form > Behavior tab > Place them in the script box at the bottom
    2. You may need to define Control IDs (names for the components) on each component that participates in your scripting. 
    3. On the controlling form object, Add one or more Custom Events > AttributeKeyValuePair > whatever fits your event needs.  You can refer to the shared functions that you embedded in the form script section.




  • 11.  RE: Looking for a way to dither (disable) components in a form.

    Posted Jul 23, 2010 01:57 PM
    Thanks for the info scottwed.

    I'm also interested on performing custom events on buttons, but the events seem to be handled by workflow a little differently.  After choosing the event (onclick in most cases), you have to insert something into the Event Handler field.  Does anyone know what to place in this field?

    Note:  This is also required in when adding a custom event to a form like scottwed suggested.


  • 12.  RE: Looking for a way to dither (disable) components in a form.

    Posted Aug 06, 2010 04:43 PM
    I found an old KB artricle about Javascript and Workflow.

    https://kb.altiris.com/article.asp?article=46704&p=1