How to conditionally override Requires Search setting

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

How to conditionally override Requires Search setting

Post by philmills »

My table has Requires Search enabled in Table Options > List Page
I would like to override this based on condition such as

if (CurrentUserLevel()=='1') {
	//don't require search
}

Whats the syntax for that and where should it be placed?


mobhar
User
Posts: 11660

Post by mobhar »

You may actually generate the script files twice. First for the Requires search option enabled, then backup the models/*List.php file to another place. After that, for the second times, make that option disabled, regenerating ALL the script files again.

You may then compare both models/*List.php file by using Winmerge application... so you will be able to know which code that will make that option enabled.


arbei
User
Posts: 9286

Post by arbei »

You better reverse it, that is, do not enable Requires Search. Then use Recordset_SearchValidated to validate the search values. If requiring search but there is no search values, you may add your own and set a warning message.


philmills
User
Posts: 535

Post by philmills »

I can't reverse it as I'm not in a position to regenerate all the code. I'm part way through upgrading from 2022 to 2023. It's a very large project.
I just need a temporary fix


arbei
User
Posts: 9286

Post by arbei »

Then you can only manually customize the generated scripts yourself.


mobhar
User
Posts: 11660

Post by mobhar »

As I mentioned before, after comparing the two versions of the related generated script files, then you will know the code that will make Requires search logic. You may use that code in Recordset_Selecting server event afterwards.


Post Reply