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:
-
Edit the Drop Down component
-
Add a Custom Event of "DisableControlIfValueisNullOrEmpty"
-
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.
-
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
-
You may need to define Control IDs (names for the components) on each component that participates in your scripting.
-
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.