Page 1 of 1

SearchOption auto (v2022)

Posted: Mon Jun 05, 2023 5:04 am
by philmills

I have a table where I have accidentally set default quick search option to Exact Match instead of leaving it blank (auto)
I can't at this point regenerate code for this table now. But I need to fix this search fonctiobality for my users.
I have at least figured out that $this->SearchOption is the var that i need to redefine.

What code do I have to edit to force this to auto?

v2022


Re: SearchOption auto (v2022)

Posted: Mon Jun 05, 2023 7:27 pm
by philmills

In the manual i found Recordset_SearchValidated server event:

To change the Quick Search criteria, change the BasicSearchKeyword and BasicSearchType property of the table object

That suggests I should be able to override the BasicSearchType property, but how?


Re: SearchOption auto (v2022)

Posted: Tue Jun 06, 2023 8:58 am
by mobhar

It seems there are no server events that can override that setting at the moment. Please correct me if I'm wrong. ;-)

However, let's use demo2023 project for orders table, you may see this following code in models/Orders.php file if you select Any word under Table setup -> Table Options -> Search -> Default search type (Quick):

$this->BasicSearch->TypeDefault = "OR";

In the other side, if you select All words, then you will see this following code:

$this->BasicSearch->TypeDefault = "AND";

For Exact match or blank option, then you will not see any code that related to the similar code above.


Re: SearchOption auto (v2022)

Posted: Tue Jun 06, 2023 9:53 am
by arbei

You may set $this->BasicSearch->TypeDefault = "" for "Auto".


Re: SearchOption auto (v2022)

Posted: Wed Jun 07, 2023 4:39 pm
by philmills

I'm confused now which function should I place this code in?


Re: SearchOption auto (v2022)

Posted: Wed Jun 07, 2023 6:39 pm
by arbei

You may simply use Page_Load server event.


Re: SearchOption auto (v2022)

Posted: Thu Jun 08, 2023 8:18 pm
by philmills

Great! That seems to have fixed it :)


Re: SearchOption auto (v2022)

Posted: Thu Jun 08, 2023 8:28 pm
by philmills

I'm already using v2023.13 to update my project.

In Table options > Search > Default search type (Quick) , if I change that setting to Anything other than the blank default (which represents Auto), its impossible to change it back to blank. You can change it momentarily, but it doesn't stick and when you return to this setting later it has always reverted to its previous selection.
Auto really should be an explicit option.


Re: SearchOption auto (v2022)

Posted: Fri Jun 09, 2023 7:03 pm
by arbei

arbei wrote:

You may set $this->BasicSearch->TypeDefault = "" for "Auto".

The blank (first) value in the dropdown is "auto".


Re: SearchOption auto (v2022)

Posted: Fri Jun 16, 2023 3:25 pm
by philmills

Yes, but once you have selected another option, you cannot revert to the blank option.
steps to reproduce:

1) change default search type from blank to something else e.g. Exact Match
2) save
3) change default search type back to blank
4) save
5) select a different table to edit
6) go back to first table
7) Blank setting has not been applied and default search type has reverted back to Exact Match


Re: SearchOption auto (v2022)

Posted: Fri Jun 16, 2023 6:43 pm
by arbei

You need to press "Del" to clear it.


Re: SearchOption auto (v2022)

Posted: Wed Sep 27, 2023 6:19 pm
by philmills

It clears, but as soon as you return to that page from elsewhere it has reverted back to "exact match"