Warn user if data being entered already exist in repeater

repeater-widget

#1

Hello, all

Anyone out there knows of a way to display a message to user when the data the user is adding to a repeater grid already exist. For example, the user attempts to update a repeater grid by adding a “SSN ID”. That number should be unique. Is there a way to display a message to user if that ID already exist in the grid?

Thank you


#2

Here is an approach that should work…

Create a “listener event” on a widget in the repeater. Pick an unused event, like Moved or Rotated and use it to test the row’s “SSN ID” against the text of the input Text Field (or global variable.)

  • On the “Add” button (or whatever widget/event) call this special event, like
    Fire Event Move of MySsnWidget in MyRepeater
    …(this will trigger the Moved event of a widget named MySsnWidget for every row)
  • In the Moved event of MySsnWidget (could be any widget in the repeater) create at least two conditional cases:
    • If [[Item.SSN]] equals text on widget InputFieldSSN
      Show MyWarningMessage
      …(where MyWarningMessage is a dynamic panel, group or widget)
      …(thus the widget “listens” to this signal and if its SSN ID matches it shows the warning. Note that each row’s widget will be “moved” in quick succession, so every row will test itself)
    • Else if [[Item.isLast]] equals "true"
      …(this is the last row and no matches, so add a new row)
      Add Row to MyRepeater
      …(using same values/data as if this were on the “Add” button)