Skip to main content
October 5, 2021
Question

Pop Up on a condition

  • October 5, 2021
  • 1 reply
  • 0 views

Hi All,

I have a use case to display pop up on click of a button. However it should be displayed only if specific flag is set to true. Can this be achieved ?

local!isDataEdited : false(), /*Confirm Message should only pop when this flag is set to true*/

a!buttonWidget(
label: "Back",
icon: "repeat",
saveinto: {},
submit: true,
style: "PRIMARY",
validate: false(),
confirmHeader: "",
confirmMessage: "Any changes will be lost if you continue to navigate away from this page.",
confirmButtonLabel: "Continue",
cancelButtonLabel: "Cancel"
)

Thank you and Appreciate your time and effort  !!

1 reply

selvakumark
Participating Frequently
October 5, 2021

A if() should do the job.

a!localVariables(
  local!isDataEdited: false(),
  /*Confirm Message should only pop when this flag is set to true*/
  a!buttonWidget(
    label: "Back",
    icon: "repeat",
    saveinto: {},
    submit: true,
    style: "PRIMARY",
    validate: false(),
    confirmHeader: "",
    confirmMessage: if(
      local!isDataEdited,
      "Any changes will be lost if you continue to navigate away from this page.",
      ""
    ),
    confirmButtonLabel: "Continue",
    cancelButtonLabel: "Cancel"
  )
)