Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically open document when only one document is listed in repeat control

Tags:

xpages

I have a repeat control for a domino view which displays the results from a search field.

As you type more characters into the search field the number of items in the list is reduced. If/When the the list only contains a single item I would like to open item automatically, without having to click the link.

Any ideas are appreciated.

Edit: after some very interesting responses, here are some screenshots

I have 3 elements on the page, a searchbar, a repeat control and a form:

enter image description here

When I start typing in the search bar, the repeat is refreshed with every keystroke:

enter image description here

the list is reduced, typing the next character ...

enter image description here

again the list is reduced, only 2 left, typing again....

enter image description here

Only one left, now it would be time to open the document in the form ..... without clicking the link.

I've tried several events on the page, but it seems that I could not find the one that will allow me to "select" the document and display the data in the form.

It seems that it's not as simple as I thought

like image 340
Thomas Theurer Avatar asked Feb 27 '26 00:02

Thomas Theurer


1 Answers

Since you want to open the link automatically I don't know if I would try to base it on the getRowCount() of the repeat itself. You don't want to even get that far right? you just want to go to the single document. I would put a function in beforePageLoad event maybe. Not totally sure which event but I'd try that first. Use SSJS and do a lookup that would basically return a collection of what the repeat would show. If the collection count = 1 then get your destination from that entry and do your redirection from there.

That what I would try at least. Interesting scenario!

like image 97
David Leedy Avatar answered Mar 02 '26 16:03

David Leedy