SearchOption auto (v2022)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
philmills
User
Posts: 535

SearchOption auto (v2022)

Post 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


philmills
User
Posts: 535

Post 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?


mobhar
User
Posts: 11660

Post 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.


arbei
User
Posts: 9286

Post by arbei »

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


philmills
User
Posts: 535

Post by philmills »

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


arbei
User
Posts: 9286

Post by arbei »

You may simply use Page_Load server event.


philmills
User
Posts: 535

Post by philmills »

Great! That seems to have fixed it :)


philmills
User
Posts: 535

Post 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.


arbei
User
Posts: 9286

Post by arbei »

arbei wrote:

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

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


philmills
User
Posts: 535

Post 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


arbei
User
Posts: 9286

Post by arbei »

You need to press "Del" to clear it.


philmills
User
Posts: 535

Post by philmills »

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


Post Reply