Hi All, I have 2 a!buttonWidgetSubmit (Button1,Button2) and 1 text field (F

Hi All,
I have 2 a!buttonWidgetSubmit (Button1,Button2) and 1 text field (Field1) in my form. In my use case, if Button1 is clicked and Field1 is blank I need to display validation message at the end of form just above button. For this I am using validations property in the a!formLayout(). However, form is getting submitted instead of validating field.
Please find my code snippet below:

validations:{if(and(isnull(ri!Field1),ri!btnAction = "Button1"),,a!validationMessage(
message: "Please provide required value",
validateAfter: "SUBMIT"
),{})

It works fine if I remove ri!btnAction = "Button1" but I need to include button action in condition.
Is anyone come across such situation. Any help would be appreciated, TIA !!

OriginalPostID-181112

OriginalPostID-181112

  Discussion posts and replies are publicly visible

Parents
  • Try the below code. If the value of the button input type is Boolean then it's working as per our desire otherwise not.
    /*
    ri!buttonAction(Boolean)
    ri!textValue(Text)
    */

    a!formLayout(
    firstColumnContents:{
    a!textField(
    label:"A",
    value:ri!textValue,
    saveInto:ri!textValue
    )
    },
    buttons:a!buttonLayout(
    primaryButtons:{
    a!buttonWidgetSubmit(
    label:"Submit",
    value:true,
    saveInto:ri!buttonAction
    )
    }
    ),
    validations:a!validationMessage(
    message:if(
    and(rule!APN_isEmpty(ri!textValue),ri!buttonAction),
    "Message",
    null
    ),
    validateAfter:"SUBMIT"
    )
    )
Reply
  • Try the below code. If the value of the button input type is Boolean then it's working as per our desire otherwise not.
    /*
    ri!buttonAction(Boolean)
    ri!textValue(Text)
    */

    a!formLayout(
    firstColumnContents:{
    a!textField(
    label:"A",
    value:ri!textValue,
    saveInto:ri!textValue
    )
    },
    buttons:a!buttonLayout(
    primaryButtons:{
    a!buttonWidgetSubmit(
    label:"Submit",
    value:true,
    saveInto:ri!buttonAction
    )
    }
    ),
    validations:a!validationMessage(
    message:if(
    and(rule!APN_isEmpty(ri!textValue),ri!buttonAction),
    "Message",
    null
    ),
    validateAfter:"SUBMIT"
    )
    )
Children
No Data