Hello Everybody, Does anyone know how to make a text/paragraph field

Certified Associate Developer
Hello Everybody,

Does anyone know how to make a text/paragraph field only required when the user tries to submit via a specific button? Currently validations on form elements do not trigger when they are blank and I can't use the "required" option since I need to check the validation only when clicking a specific button. I have created a dummy snippet that demonstrates the problem:

load(
local!comment,
a!formLayout(
firstColumnContents: {
a!paragraphField(
value: local!comment,
saveInto: local!comment,
validations: if (len(local!comment) = 0, "You must enter a phrase.", ""),
validationGroup: "comment"
)
},
buttons: a!buttonLayout(
primaryButtons: a!buttonWidgetSubmit(label:"Validate", validationGroup: "comment"),
secondaryButtons: a!buttonWidgetSubmit(label:"Cancel")
)
)
)

OriginalPostID-139172

OriginalPostID-139172

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer
    load(
    local!comment,
    a!formLayout(
    firstColumnContents: {
    a!paragraphField(
    value: local!comment,
    saveInto: local!comment,
    required : true,
    validationGroup: "comment"
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(label:"Validate", validationGroup: "comment"),
    secondaryButtons: a!buttonWidgetSubmit(label:"Cancel")
    )
    )
    )
Reply
  • 0
    Certified Senior Developer
    load(
    local!comment,
    a!formLayout(
    firstColumnContents: {
    a!paragraphField(
    value: local!comment,
    saveInto: local!comment,
    required : true,
    validationGroup: "comment"
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(label:"Validate", validationGroup: "comment"),
    secondaryButtons: a!buttonWidgetSubmit(label:"Cancel")
    )
    )
    )
Children
No Data