Multiple Validation group on a same field

Certified Senior Developer

Can I have multiple validation groups for the one sail component? 

Considering I have Field A, Field B, and 3 buttons. Field A is mandatory for 2 buttons Button_A and Button_B. How to achieve this?

{
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!textField(
              label: "Name",
              labelPosition: "ABOVE",
              saveInto: {},
              required: true,
              refreshAfter: "UNFOCUS",
              validationGroup:  
                {
                  "Button_A",
                  "Button_B"
                }
              
            ),
            a!textField(
              label: "Mobile Number",
              labelPosition: "ABOVE",
              saveInto: {},
              required: true(),
              refreshAfter: "UNFOCUS",
              validations: {},
              validationGroup: "Button B"
            )
          }
        ),
        
      }
    ),
    a!buttonArrayLayout(
      buttons: {
        a!buttonWidget(
          label: "Button A",
          style: "NORMAL",
          submit: true(),
          validationGroup: "Button_A"
        ),
        a!buttonWidget(
          label: "Button B",
          style: "NORMAL",
          submit: true(),
          validationGroup: "Button_B"
        ),
        a!buttonWidget(
          label: "Button C",
          style: "NORMAL",
          submit: true(),
          validationGroup: "Button_C"
        )
      },
      align: "START"
    )
}

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hi  , 
    I hope ,I have understood your requirement correctly. 
    I updated the code, which you can try. 
    Here, Button_A and Button_B will check requiredness for "Name" textField. 
    Whereas, Button_C will check requiredness for "Mobile_Number" textfField. 

    a!localVariables(
      local!name,
      local!number,
      {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Name",
                  labelPosition: "ABOVE",
                  saveInto: local!name,
                  value: local!name,
                  required: true,
                  refreshAfter: "UNFOCUS",
                  validationGroup: "Name_Condition",
    
                ),
                a!textField(
                  label: "Mobile Number",
                  labelPosition: "ABOVE",
                  value: local!number,
                  saveInto: local!number,
                  required: true(),
                  refreshAfter: "UNFOCUS",
                  validations: {},
                  validationGroup: "MobNumber_Condition"
                )
              }
            ),
    
          }
        ),
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Button A",
              style: "",
              submit: true(),
              validationGroup: "Name_Condition"
            ),
            a!buttonWidget(
              label: "Button B",
              style: "",
              submit: true(),
              validationGroup: "Name_Condition"
            ),
            a!buttonWidget(
              label: "Button C",
              style: "",
              submit: true(),
              validationGroup: "MobNumber_Condition"
            )
          },
          align: "START"
        )
      }
    )


    In addition to this, you can refer, 
    https://docs.appian.com/suite/help/23.4/recipe-use-validation-group-for-buttons-with-multiple-validation-rules.html

Reply
  • 0
    Certified Senior Developer

    Hi  , 
    I hope ,I have understood your requirement correctly. 
    I updated the code, which you can try. 
    Here, Button_A and Button_B will check requiredness for "Name" textField. 
    Whereas, Button_C will check requiredness for "Mobile_Number" textfField. 

    a!localVariables(
      local!name,
      local!number,
      {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Name",
                  labelPosition: "ABOVE",
                  saveInto: local!name,
                  value: local!name,
                  required: true,
                  refreshAfter: "UNFOCUS",
                  validationGroup: "Name_Condition",
    
                ),
                a!textField(
                  label: "Mobile Number",
                  labelPosition: "ABOVE",
                  value: local!number,
                  saveInto: local!number,
                  required: true(),
                  refreshAfter: "UNFOCUS",
                  validations: {},
                  validationGroup: "MobNumber_Condition"
                )
              }
            ),
    
          }
        ),
        a!buttonArrayLayout(
          buttons: {
            a!buttonWidget(
              label: "Button A",
              style: "",
              submit: true(),
              validationGroup: "Name_Condition"
            ),
            a!buttonWidget(
              label: "Button B",
              style: "",
              submit: true(),
              validationGroup: "Name_Condition"
            ),
            a!buttonWidget(
              label: "Button C",
              style: "",
              submit: true(),
              validationGroup: "MobNumber_Condition"
            )
          },
          align: "START"
        )
      }
    )


    In addition to this, you can refer, 
    https://docs.appian.com/suite/help/23.4/recipe-use-validation-group-for-buttons-with-multiple-validation-rules.html

Children