Automatically open document if only one document is specified in re-control mode

I have a duplicate domino view control that displays results from a search box.

As you enter more characters in the search field, the number of items in the list decreases. If / If the list contains only one item, I would like to open the item automatically without clicking on the link.

Any ideas are appreciated.

Edit: After some very interesting answers, here are some screenshots

I have 3 items per page, a search bar, a repeat control and a form:

enter image description here

When I start typing in the search bar, the repeat is updated with every key press:

enter image description here

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

enter image description here

again the list is decremented, there are only 2 left, typing again ...

enter image description here

There is only one thing left: now it's time to open the document in the form ..... without clicking the link.

I've tried several events on the page, but I can't seem to find one that allows me to "select" the document and display the data in the form.

It seems that it is not as easy as I thought


source to share

3 answers

Since you want to automatically open the link, I don't know if I will try to set it to the getRowCount () of the retry itself. Don't you even want to get it right? you just want to go to one document. Perhaps I would put the function in the beforePageLoad event. Not really sure what event, but I would try this first. Use SSJS and do a search that basically returns a collection of what will be shown in replay. If collection count = 1, then get destination from this record and redirect from there.

No matter what I try. Interesting scenario!



Now that I see screenshots, it might be easier than you think, and I have already implemented something similar in an internal application I created. It relies on the fact that each entry in the list is 100% unique.

First of all, you need to bind the search field to a scoped variable, and the onchange / onkeypress event should do a partial refresh of the panel containing both the list and part of the document on the page.

For a list, the link to each item must be set to the same scope variable used in the search box, and the link must be clicked to partially refresh the document scope.

For the document area you will need two panels, the first panel will only show if there is no corresponding document and the second panel will only show if there is a matching document, you can do this in render by writing some ssjs that grabs handle db / view and does dblookup and returns true or false if the document exists depending on the panel you are working with.

With this setting, when someone clicks on a link or fills in the search box, the scoped variable will hold the value, the document panes will check if it is a unique value in the view in the db and update itself to display the no document pane or pane "document" accordingly.



You can add a script evaluation to your redo control entry that checks the size of your redo control using the getRowCount () method from the component. If it's 1, you can do context.redirectToPage ("yourpage.xsp? Id = yourid", true), this makes the current page send a redirect request back to the browser and therefore redirects you to the correct page.

All you need to know is the xpage you need to open and what options you should use. But they can be extracted from the content you are repeating.



All Articles