I Love PHPMaker

... because it gets even more powerful and flexible!!

  • About
  • Terms and Conditions
  • Membership Options
  • Sitemap
  • Downloads
    • PHPMaker Extensions Download
    • PHPMaker Projects Download
    • PHP Report Maker Extensions Download
I Love PHPMaker » Tips and Trick » How to Define Default Operator in Advanced Search of Websites that Generated by PHPMaker 9.0.4
How to Force Users to Select Values in Advanced Search of Websites that Generated by PHPMaker 9.0.4
How to Prevent the Blank Keyword in Search Panel of Websites that Generated by PHPMaker 9.0.4

October 28, 2012

How to Define Default Operator in Advanced Search of Websites that Generated by PHPMaker 9.0.4

One of the most flexible features that provided by PHPMaker is the ability to search records by using Advanced Search. This feature allows us to define which fields should be involved, and which operator should be used by default when users are accessing the Advanced Search page. For example, if you defined USER SELECT in Search Opr 1 column in Fields setup of PHPMaker, then in the generated Advanced Search pages will display the equal sign (=) as the default search operator. Users then are able to change that search operator in order to suits with their needs. For example, they will switch it become the not equal sign (<>), and so forth.

Sometimes, you want to define that default search operator for the string type fields become the contains (LIKE) and you are still using USER SELECT in Search Opr1 from PHPMaker. The question is, how can we do that, since there is no preference in PHPMaker to define which operator should be the default?

The answer is: We can even define it without having to modify the generated script files! As I mentioned above, PHPMaker has the flexible feature for this, even PHPMaker has not provided the related setting for this in Fields setup section. We are able to define the default search operator even we are using USER SELECT as the value in Search Opr1 of Advanced Search in PHPMaker. This following trick will show you how to define default search operator in Advanced Search pages of websites that generated by PHPMaker. We will define it from Server Events side of PHPMaker, so we can implement it for another projects. In the following example below, we will define the default search operator become contains (LIKE).

Updated on November 29, 2012: This customization has been implemented in PHPMaker version 9.1.0, it matches to each other, and as a result, it works properly.

Updated on February 10, 2013: This customization has been implemented in PHPMaker version 9.2.0, it matches to each other, and as a result, it works properly.

[hidepost]

  1. Open your PHPMaker project (.pmp) file by using PHPMaker application.
  2. Expand your tables/views from Database pane in the left side of your PHPMaker application.
  3. Click on one of your desired tables/views, and you should see three tabs in the right pane of PHPMaker application. They are: Fields, Tables, and Code (Server Events, Client Scripts and Custom Templates). Now, make sure the Fields tab has been selected.
  4. Click on one of your desired fields from the right pane of PHPMaker application, then scroll to the most of right, you should see Advanced Search Page preference. Make sure in the Search column has been checked, and then in the Search Opr 1 has been chosen with USER SELECT value. Repeat this step for your another fields (if any).
  5. The next step, we will write our own code from the Server Events to define the default search operator. To do this, make sure the selected table in the previous steps has been selected. Click on Code (Server Events, Client Scripts, and Custom Templates) and then expand this location: Server Events -> Table Specific -> Search Page -> Page_DataRendering, and then insert the following code into the Page_DataRendering function in editor code at the right pane of PHPMaker application:

        $this->MyFirstStringField->AdvancedSearch->SearchOperator = "LIKE";
        $this->MySecondStringField->AdvancedSearch->SearchOperator = "LIKE";
    

    Please note that from the code above, we will define the default search operator of Advanced Search for two fields. Their name are: MyFirstStringField and MySecondStringField. Don't forget to adjust them with yours. It's very easy and simple, yet so powerful, isn't?

  6. Finally, re-generate your script files using PHPMaker as always.

[/hidepost]

Article by Masino Sinaga / Tips and Trick / Advanced Search, contains, Page_DataRendering, PHPMaker 9.0.4, PHPMaker 9.1.0, PHPMaker 9.2.0, search operator, search page, Server Events, User Select Leave a Comment

How to Force Users to Select Values in Advanced Search of Websites that Generated by PHPMaker 9.0.4
How to Prevent the Blank Keyword in Search Panel of Websites that Generated by PHPMaker 9.0.4

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • A New PHPMaker 2025 Project File Is Released
  • PHPMaker 2025 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2025 Is Released!
  • A New PHPMaker 2024 Project File Is Released
  • PHPMaker 2024 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2024 Is Released!
  • PHPMakerProjects.com, For Those Who Need PHPMaker Project Sample
  • A New PHPMaker 2023 Project File Is Released
  • PHPMaker 2023 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2023 Is Released!

Search

Recent Comments

  • Masino Sinaga on Masino Extensions for PHPMaker 2024 Is Released!
  • Masino Sinaga on A New PHPMaker 2024 Project File Is Released
  • Masino Sinaga on PHPMaker 2023 Demo Project File Is Released
  • Edward Babatunde on PHPMaker 2023 Demo Project File Is Released
  • Edward Babatunde on Masino Extensions for PHPMaker 2024 Is Released!

Demo Website

  • Demo of I Love PHPMaker 2025 (MasinoExtensions).
  • Stock Inventory Management for PHPMaker 2025.

Another Demo

The following template are not available in this site (must be purchased separately)

  • PHPMaker v2018 Horizontal Vertical Template.
  • PHPMaker v2017 Horizontal Vertical Template.

Demo Explanation

Stock Inventory Management is the good project for your reference, since it uses the real example in the real world. Many useful features you can use from this project, such as how to add the Thousand and Decimal separator character, and also how to calculate multiple row in Grid-Add when End-Users are entering data into the Grid-Add mode.

Categories

  • Customize Template (103)
  • General (4)
  • PHP Report Maker (17)
  • PHP Report Maker Extensions (2)
  • PHPMaker Extensions (84)
  • PHPMaker Projects (7)
  • Tips and Trick (72)

Articles based on version

  • PHPMaker 2025
  • PHPMaker 2024
  • PHPMaker 2023
  • PHPMaker 2022
  • PHPMaker 2021
  • PHPMaker 2020
  • PHPMaker 2019
  • PHPMaker 2018
  • PHPMaker 2017.0.7
  • PHPMaker 12.0.7
  • PHPMaker 11.0.6
  • PHPMaker 10.0.5
  • PHPMaker 9.2.0
  • PHPMaker 8.0.3
  • PHP Report Maker 12

(c) I Love PHPMaker 2010 - 2025 by Masino Sinaga | WordPress | Log in | Back to top