I realize there has been some discussion on this (including a feature request), but I am looking for some assistance with a javascript work-around. Specifically, I would like to either (i) make the Comments box required conditionally when user clicks "Reject" or another action button, or (ii) make the Comments box required all the time.
The typical code I use to make a field required with js is:
$('.fieldname label').append('<span class="cf-required">*</span>'); $('.fieldname input').prop('required', true);
where .fieldname is the field identifier. Trying to apply this to the Comments box, I use:
$('#comments').append('<span class="cf-required">*</span>'); $('#comments').prop('required', true);
The problems are:
- I can't get the asterisk on the Comments box because it doesn't have a <label> area to target. The "Comments" text is just in a <p>...</p> line in the container, not in a <span> element or <label> element. Tried a bunch of targets, but not able to get the asterisk to display to the user. This is an inconvenience, but not too bad.
- Applying the required property works - if there is no input in the Comments box, the form turns the box red and displays "Value is required." However, if you click an action button, all the other fields on the forms disappear (as though it were submitted), but the Comments box remains there and in its "red" state. The form doesn't actually submit - if you close the form, it remains in your Task Inbox and can be opened again. This one is more than an inconvenience, it breaks the user experience. I tried both Chrome and Firefox, same behavior. Forms v10.2.
Any ideas or suggestions, esp on #2?
Thanks, ..... Steven.