Ryan_Coleman | Posts: 258

Examples of Radio Buttons with groups

0 votes
Guys, I cannot seem to find documentation on how to create radio buttons and groups. Do you guys have any examples or documentation that you can point me to?

Duo_Liang | Posts: 3776

Reply to: Examples of Radio Buttons with groups

0 votes
Hi Ryan, I had a blog Creating a Radio Button Field describing how to create Radio Buttons in Rest and SDK methods. This is the .Net SDK code:
Field radio1 = FieldBuilder.RadioButton("group1")
                         .WithId(("signer1_group1_radio1")
                         .WithName(("signer1_group1_radio1")
                         .WithSize(15,15)
                         .OnPage(0)
                         .AtPosition(100,100)
                         .WithValue(true)                        //selected by default
                         .WithValidation(FieldValidatorBuilder.Basic().Required())  //add a required validator
               .Build();
And the equivalent JSON was:
{
   "id":"signer1_group1_radio1",
   "name":"signer1_group1_radio1",
   "type":"INPUT",
   "subtype":"RADIO",
   "page":0,
   "height":15,
   "width":15,
   "left":100,
   "top":100,
   "value":"X",
   "validation":{
      "required":true,
      "enum":[
         "group1"
      ]
   }
}
You can find more detailed explanations regarding the parameters in the article. Hope this could help! Duo

Ryan_Coleman | Posts: 258

Reply to: Examples of Radio Buttons with groups

0 votes
Duo, In the validation object, what is the enum field used for? Does it just need to contain the name of the group associated with the radio buttons?

Duo_Liang | Posts: 3776

Reply to: Examples of Radio Buttons with groups

0 votes
Hi Ryan, Yes, exactly as you understood, the enum field is used to identify which group current field belongs to. To note, since fields are only bound to the specific signer so same as radio group, different signer with same group name won't cause ambiguity for OneSpan Sign. (although it's not suggested) Duo

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off