IT Process Automation

 View Only
Expand all | Collapse all

IRF - Make text field required when one Radio button is selected

Anon Anon

Anon AnonOct 17, 2014 02:52 PM

  • 1.  IRF - Make text field required when one Radio button is selected

    Posted Oct 15, 2014 11:29 AM

    Hello,

     

    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.



  • 2.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 15, 2014 12:47 PM

    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?

     

    Thanks,

    Tom



  • 3.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 17, 2014 02:52 PM

    Thank you, Tom!



  • 4.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 17, 2014 12:00 PM

    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.

     

    Regards,

    Duarte Sousa



  • 5.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 17, 2014 02:51 PM

    Thanks Duarte, this sounds like a good solution to use in the mean time. I appreciate it!



  • 6.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 17, 2014 02:56 PM

    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.



  • 7.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 17, 2014 03:03 PM

    OK, we are currently using 4.2 SP2, so that would be great!



  • 8.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 18, 2014 05:51 PM

    Just checked and this function is now available in 4.2 SP2

     

    ca_pam_setRequired(_id, isRequired)



  • 9.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 20, 2014 03:47 PM

    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...



  • 10.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 20, 2014 04:02 PM

    Before proceeding, is Approve/Reject part of a dropdown?  If not, what form element are you using there?



  • 11.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 20, 2014 04:07 PM
      |   view attached

    Approve/Reject are radio buttons. I have attached the IRF draft for your reference. Thanks, Tom.

    Attachment(s)

    zip
    DSA Workflow IRF.xml.zip   2 KB 1 version


  • 12.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 20, 2014 04:52 PM

    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.



  • 13.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 20, 2014 04:58 PM

    This function was added in 4.2 SP2



  • 14.  Re: IRF - Make text field required when one Radio button is selected
    Best Answer

    Posted Oct 20, 2014 04:58 PM

    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:

     

    ca_pam_setRequired('Form.Comments', false)

     

    Thanks,

    Tom



  • 15.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 20, 2014 07:19 PM

    Thanks, Tom! Worked like a charm



  • 16.  Re: IRF - Make text field required when one Radio button is selected

    Posted Oct 17, 2014 03:16 PM

    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:

     

    RadioButtonIsRequired

         FieldRequiered

         FieldNotRequired

     

    So user clicks the radio button for the option not required. The behaviour of the form makes the FieldRequired Invisible. So we have this:

     

    RadioButtonIsRequired

         FieldNotRequired

     

    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.