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.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
open browse empty
-
- Posts: 785
- Joined: Sun Oct 14, 2018 11:25 am
Re: open browse empty
Hi,
You can use Hash Cookies in your Browse SQL like this:
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:
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.
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
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 );
})
}
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.
-
- Posts: 92
- Joined: Mon May 14, 2018 3:26 pm