We have specific steps in our BP that we would like to make a Comment required before the User is able to select an option.
Question
Question
Answer
Thanks for the feature request! I'll pass this along to the team. In the meantime, because you can target the user task comments and action buttons with the JavaScript you include with your form, you should be able to accomplish what you're trying to do with a small amount of code.
Replies
Here is the Javascript I have used to make the Reject button require comments:
$(document).ready(function () {
$('.Reject').click(function(){
if($('#comments').val() == '')
{
alert('Please enter information into the Comments box before selecting this action');
return false;
}
});
});
++
This is similar to something I've asked for before. It would be nice to have templates support conditional rules: Fields that require other fields to be filled, if a value is more than a certain amount then require a certain field, or show/hide or enable/disable certain fields depending on various conditions.
Depending on the type of field you are dealing with you can programmatically disable an option (making it appear "grayed out") until you fill in a different field. You can also hide that field until you fill in a different field.
I will post a javascript example in a moment.
Edit: I see you don't need that. I thought you were talking about on the form. sorry!
It has to do with the comment box when the form is at a User Task. It is not a field that is added to the form, it is built into Forms.
You can target the comment box with JavaScript when you're building a form, so you should be able to accomplish this using the same methods described in other answers on this site.
The HTML markup for the comment box and its buttons:
Target the comment box using the #comments selector, and the buttons collectively with .action-btn.
I just want to make sure the above HTML markup is used to make the comment field required as the original questions requested for and how, please be more specific considering the fact that i am not good in Jquery and also specify where can i add this in the forms to achieve it.
I had already tried this but didn't work for me can you please let me know in detail how to apply the above HTML markup for my form, actually my requirement is when the form is rejected the comment should be made required.
Please let me know if this is possible ??
Is someone please able to post the Javascript used to make Comments a required field before Approval/Rejection?
Thanks
Thanks, Grant. I used the JavaScript above to make the Comments box required. Thank you. The only issue I'm having is that sometimes the comments box is disabled and I cannot type anything in it. For a temporary fix, I placed some custom HTML text to the user to use F5 to refresh:
Has anyone else had an issue with the following JavaScript?
$(document).ready(function(){ //Make comments required when rejecting $('.Reject').click(function(){ if($('#comments').val() == '') { alert('Please enter information into the Comments box before selecting this action'); return false; } }); }); //close document.ready
I am finding that if I am using a form with no tabs, I get redirected to a page with only the comments box showing red. I can't return to the rest of the form. Any tips on how to prevent?