Am using FormAPI.setRequired("checkboxfieldid").id; in on load event o

Am using FormAPI.setRequired("checkboxfieldid").id; in on load event of form to make checkbox field as required dynamically. The checkbox allows multiple values. Am storing the selected values of checkbox in to DB.The statement is setting the field as required but it is not displaying the values that are selected. If am removing the required statement it is displaying the selected values. It is also working when checkbox is of single type and only 1 value is selected. Please help me how to make multivalued checkbox as required dynamically.........

OriginalPostID-65101

OriginalPostID-65101

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer
    Hi Sudha, even for that, the same approach works. i tried now.
    On click of radio button,
    var radVal = FormAPI.getValue("radifieldId").id;
    if(radVal=="Yes")
    {
    FormAPI.show("multichkboxID");
    FormAPI.setRequired("multichkboxID",true);
    }
    else
    {
    FormAPI.hide("multichkboxID");
    FormAPI.setRequired("multichkboxID",false);}
    And in frm onload, initially keep the chekbox hidden.
    This approach works fine for me.
    Hope it helps
Reply
  • 0
    Certified Senior Developer
    Hi Sudha, even for that, the same approach works. i tried now.
    On click of radio button,
    var radVal = FormAPI.getValue("radifieldId").id;
    if(radVal=="Yes")
    {
    FormAPI.show("multichkboxID");
    FormAPI.setRequired("multichkboxID",true);
    }
    else
    {
    FormAPI.hide("multichkboxID");
    FormAPI.setRequired("multichkboxID",false);}
    And in frm onload, initially keep the chekbox hidden.
    This approach works fine for me.
    Hope it helps
Children
No Data