I am creating an approval IRF comprised of 2 Text Fields (Form.Information, Form.Comments), 1 HTML (Form.Approval_Instruction) and 1 Select field (Form.Status). Options for the Select field are "Approved" (Form.Status.Approve) and "Rejected" (Form.Status.Reject). I want the Comments text field to be required only if the "Rejected" radio button is selected (onClick). Is this possible using the PAM built in functions? I know I can use something like ca_pam_isSelectRadio('Form.Status','Form.Status.Reject'), but I'm missing the part that references "Comments" and makes it required. I also tried modifying the validate script used in this thread how to create new form element function, but could not get the Alert to work. In any case, I would prefer not to have an alert, but to prevent the user from submitting the form if the Comments box is not filled out, after selecting Rejected. Please assist.
I don't believe this functionality is available today. I know it's on the priority list and may be part of the next release. brafr04, can you confirm?
Thank you, Tom!
As Tom Kouhsari said, I think that funcionality is not implemented yet too.
What can you do (it will give a **** of work) is creating 2 fields for each option (one with the required and other without) and depending if the radio button is selected... or not, you can play with the hide property showing the field with or without the required.
Thanks Duarte, this sounds like a good solution to use in the mean time. I appreciate it!
Before you go down this path, I just found out that the feature you want may be available in 4.2 SP2. I'm trying to find out more and will update you here when I get that info.
OK, we are currently using 4.2 SP2, so that would be great!
Just checked and this function is now available in 4.2 SP2
OK, just so I'm clear...I want the Comments (Form.Comments) box to be Required only if a user clicks on Reject (Form.Status.Reject). So, I updated the OnClick value of Form.Status.Reject to be ca_pam_setRequired('Form.Comments', true), and good news is, it worked! But the bad news is, once I select Reject, and it makes Comments required, if I click back to Approve (which I do NOT want Comments to be required), it does in fact make this field Required. So it seems, once its Required, it's always Required, no matter if the user clicks back to the other option. Is there a way around this? I think this may be similar to what alealvarez is referencing...
Before proceeding, is Approve/Reject part of a dropdown? If not, what form element are you using there?
Approve/Reject are radio buttons. I have attached the IRF draft for your reference. Thanks, Tom.
Hey, i tried the fx "ca_pam_setRequired('Form.Comments', true)" and doens´t work, neither is highlited with the syntax recognition of the scripting interface. Im using PAM 4.1.
This function was added in 4.2 SP2
Ok, that makes it pretty easy. Right now you are calling ca_pam_setRequired in the onClick event for Reject. Do the same thing for Approve but set the second argument to false:
Thanks, Tom! Worked like a charm
Sorry if i don't get it correctly, but duplicating the field and setting one version requiered and one version not, and then hiding and showing one or another doesn't solve anything (i'm having the same issue). Let me explain this better:
So user clicks the radio button for the option not required. The behaviour of the form makes the FieldRequired Invisible. So we have this:
The user wheter or not fills the "FieldNotRequired", he continues to interact with the form, and then submits it. But he will get and error that FieldRequired is empty. Because the validation of the required field occurs despite de display configuration of the form. So the FieldRequired is invisible, but still required to complete validations and submit the form.
If i get it wrong, i would thank any hint or explanation, or trick to solve this.
Thank you very much.