Filtering a repeater to enable a button

I need a filter to compare the contents of a repeater cell to a user’s text entry. The entry would have to be an exact match so with each text change {or key up} you’d compare what the user entered with all of the repeater items. So if you had a set of names: Jim, John, James here’s what would be returned with each key:
“Jo” = false
“JohN”= true

So only with “true” would the button be enabled.

I’d use the OnTextChange event of the Text Field widget, and test the contents of the field against the repeater, including the .toLowerCase() function on both in order to make your comparison case sensitive.
I believe you’ll need to do the trick of moving a hidden object in the repeater row to execute the test.
Something like

  • OnTextChange
    – move object by 0,0
    — onMove of that object see if textfield.toLowerCase() == Item.columnName.toLowerCase()
    ---- and if it does, enable button

Admitting that my pseudocode is messy, I hope it helps nonetheless…

1 Like

Appreciate the response. I tried it but that doesn’t work for some reason. Not sure if I also need an index filter?

test enable repeater.rp (55.2 KB)

Got a response from Axure. It now works! Attaching the RP file for you

test enable repeater revised.rp (51.0 KB)

Hey there -

The reason this isn’t working is that the move event causes the logic to be evaluated for ALL of the items in the repeater. So let’s say you type Mondo DB. On the first item, it will enable the go button, but it will then evaluate “Redis” which doesn’t match and thus will disable the button. To see what I mean, try using “Wordpress” in your file and you’ll notice it will work as it’s the last one.

I got it to work by doing the following:

  1. adding another global variable. On text change of the field I set that variable to false (essentially resetting this each time the text changes), and keeping your trigger to move your checker.

  2. I changed the logic on the checker so that if there’s a match, the checker will set the new variable to true.

  3. After the checker is evaluated, I move the Go button. The go button has a new event that enables the button if the value of the variable is TRUE. Else, because we reset the variable to false, it will be disabled.

I’m sure there are other ways to do this!

test enable repeater_EDIT.rp (57.1 KB)

Interesting … wondering why the names have to be in a repeater? Naturally, you may have a reason that is not represented in the .rp file you’ve attached. But what you’re doing could be accomplished by having a string like “Mondo DB Redis Apache MySQL Ghost Wordpress” (lets call it variable dbNames) and just doing
if dbNames.indexOf(searchText.text) > -1

But of course, if you’re happy with what you’ve got working, don’t let me spoil the fun!!

The project I’ll use this for already has this set up as a repeater. It has some other attributes in it as well