Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Radio Button correct value for referencing

Avatar

Former Community Member

Am really struggling with a particular Radio Button, and feel I'm missing using the right case value.  Am using similar code throughout the form radio buttons, but in this case I've tried making the case Y, Yes, 1, with and without quotes, =, ==, and nothing works yet.  The button is in a table cell, no subform and the response in the table cell below, no subform.  The binding value on the button - value is 1, Item = Yes, value 2, Item = No.  Appreciate any help, thank you!

switch (this.rawValue)

{

    case "Y":

    Response12BN.presence = "invisible";

    xfa.host.messageBox("Attach a copy of your company’s safety manual and safety incentive programs.",  "SAFETY PROGRAM ATTACHMENTS", 3, 1);

    break;

   

    case "N":

    Response12BN.presence = "visible";

    Response12BN.rawValue = xfa.host.response("Please enter the reason you do not have a Written Safety Program here", "WRITTEN SAFETY PROGRAM");

    break;

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Reasonable straightforward. You just need to use the bound values of the radio button (1 or 2):

switch (this.rawValue)

{

    case "1":

    Response12BN.presence = "invisible";

    xfa.host.messageBox("Attach a copy of your company’s safety manual and safety incentive programs.",  "SAFETY PROGRAM ATTACHMENTS", 3, 1);

    break;

    case "2":

    Response12BN.presence = "visible";

    Response12BN.rawValue = xfa.host.response("Please enter the reason you do not have a Written Safety Program here", "WRITTEN SAFETY PROGRAM");

    break;

}

Should work,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

Reasonable straightforward. You just need to use the bound values of the radio button (1 or 2):

switch (this.rawValue)

{

    case "1":

    Response12BN.presence = "invisible";

    xfa.host.messageBox("Attach a copy of your company’s safety manual and safety incentive programs.",  "SAFETY PROGRAM ATTACHMENTS", 3, 1);

    break;

    case "2":

    Response12BN.presence = "visible";

    Response12BN.rawValue = xfa.host.response("Please enter the reason you do not have a Written Safety Program here", "WRITTEN SAFETY PROGRAM");

    break;

}

Should work,

Niall