validation is not working in form layout

 a!textField(
                                label: "Title:",
                                labelPosition: "JUSTIFIED",
                                value: local!data.requestTitle,
                                saveInto: {a!save(local!data.requestTitle, save!value) },
                                validations:(
                                if(a!isNullOrEmpty(local!data.requestTitle),
                                "Title is Required ",
                                {},
                                )),
                                
                             refreshAfter: "KEYPRESS",
                            characterLimit: 100,
                            required: true,
                        ),
                 buttons: a!buttonLayout(
                  primaryButtons: {
                    a!buttonWidget_23r3(
                      label: "Submit",
                      style: "PRIMARY",
                      submit: true,
                      saveInto: { },
                      loadingIndicator: true(),
                      validate: true(),
                    )
                  },
                  secondaryButtons: {
                    a!buttonWidget_23r3(
                      label: "Cancel",
                      style: "NORMAL",
                      submit: true,
                      validate: false,
                      value: true,
                      saveInto: ri!cancel
                    )
                  }
                )

i added validation if title field is empty then validation should display saying "title is required" but the validation is not working in above code .can someone please help

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to Tabassum

    The code seems a bit off. I think you pasted the button's code in between the textField. I have simplified the code for you. 

    a!textField(
      label: "Title:",
      labelPosition: "JUSTIFIED",
      value: local!data.requestTitle,
      saveInto: local!data.requestTitle,
      refreshAfter: "KEYPRESS",
      characterLimit: 100,
      required: true,
    ),

    Now can you tell me what is happening when you click on the button?