Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

open browse empty

Questions related to using nuBuilder Forte.
Post Reply
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

open browse empty

Unread post by marc »

Hello,

How can I make a browse form not show any records when it is opened?
Records should only be displayed after entering a search string (at least three characters long) and starting the search action.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open browse empty

Unread post by admin »

marc,

nuBuilder only works the opposite way.


Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: open browse empty

Unread post by toms »

Hi,

You can use Hash Cookies in your Browse SQL like this:

Code: Select all

SELECT * FROM YOUR_TABLE WHERE LENGTH('#SEARCH_FIELD#' ) > 2 AND LOCATE('#','#SEARCH_FIELD#') = 0
Explanation: The Hash Cookie is unknown (empty value) when the form is initially opened. Therefore the SQL returns 0 rows ( => empty Browse Table)

And then you need to add some Custom Code -> JS:

Code: Select all

if (nuFormType() == 'browse') {
   $('#nuSearchField').on('change keydown paste input propertychange click keyup blur', function() {
       nuSetProperty('SEARCH_FIELD', this.value );   
  })
}
Explanation: Whenever the text in the Search Field is changed, the Hash Cookie is assigned the value of the search field.
The next time a Search Action is peformed, the Hash Cookie is not empty anymore and the query outputs records, given that the length of the search string is at least 2 characters.
Last edited by Anonymous on Mon Jul 09, 2018 2:42 pm, edited 1 time in total.
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: open browse empty

Unread post by marc »

toms,

Thank you so much - works as expected!
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: open browse empty

Unread post by admin »

.
Post Reply