Skip to main content
eddym0001
March 27, 2022
Question

Radio Button

  • March 27, 2022
  • 6 replies
  • 0 views

Hello,

I new in appian and a have a trouble with radio button,

I have an interface with textfield and rabio button, (name, ID) I need to validate the textfield acccoriding to selecton made in radio button. I mean, If  In  rabio burron I chosse (name), the textfield only recive charters, if I choose ID in textfiled put only numbers.

I've created a localvariable to save the seleccion, But I don't know how to continue..

Colud you help me, pelase?

Best regards

6 replies

eddym0001
eddym0001Author
March 27, 2022

Ans I have the code to do the validations

stefanhelzle0001
Brainy
March 27, 2022

Something like this?

a!localVariables(
  local!value,
  local!useName: true,
  {
    a!radioButtonField(
      label: "Radio Buttons",
      choiceLabels: {"Name", "ID"},
      choiceValues: {true, false},
      value: local!useName,
      saveInto: local!useName,
    ),
    a!textField(
      label: "Text",
      value: local!value,
      saveInto: local!value,
      validations: if(
        a!isNotNullOrEmpty(local!value),
        if(
          local!useName,
          if(
            len(stripwith(local!value, "0123456789")) = len(local!value),
            null,
            "Only characters"
          ),
          if(
            len(stripwith(local!value, "0123456789")) <> len(local!value),
            null,
            "Only digits"
          )
        ),
        null
      )
    )
  }
)

eddym0001
eddym0001Author
March 28, 2022

Thank so much...