home  products examples manual  faq support forum  contact news  login store

More Examples:   View Source:   searchInEditNew

Free Download

This demo allows you to enter complaint records for products you are supporting. You can perform a search in the both the EDIT/NEW record forms for the product the customer is complaining about.

This is a Demo. You can not change anything for security reasons.
Back to Grid     phpLens Settings  Column Settings   Choose   Generate PHP Code   Remove All Settings   ?  
FieldADDRESS1   Type: string[210]   Change Type
Default Title
Grid Title
Edit Title 2 Fields in Row
New Title 2 Fields in Row
Edit Notes
Use {KEY} to incorporate primary key, and prefix ?EDIT? or ?NEW? to display note only in EDIT or NEW state
Detail Title 2 Fields in Row
Filter Title
Input Dimensions
(suggested size: 48 x 1)
Columns:   Rows:

Power Lens
Lookup Values
Input Type       Enter a lookup to allow check boxes and radio buttons
# check/radio columns
Overlib Text
Search Lookup when editing
Matching above sql with fields
Minimum character length   Search mode   Hide key code
 X: 0-9 A-Z             x: 0-9 A-Z optional       Z: 0-9 A-Z _            z: 0-9 A-Z _ optional
#: 0-9 9: 0-9 optional +: positive numbers only
&: any character ?: any character optional \: escape character >: to uppercase <: to lowercase =EMAIL: email validation
Validation Error Msg
Default New Value
Prefix value with = to execute PHP code and % for SQL function
Optional Editable ColumnEnabled when Column   has value Enter A^B^C, or * for any non-empty value
Power Edit Lens
Grid TD Attributes   (nowrap, width=30%, align=center etc.)
Cell Color grid^title^input  
Color Reference opens in a new window

Section Break Title
Back color   CSS class

WYSIWYG Editor for fields that accept HTML
Do not convert
Special Chars
This Field supports Double-Byte (eg Chinese, Japanese) and HTML tags
Must FillNo   * Must Fill Columns
Read OnlyNo   - Read Only Columns
Visible in GridYes   Grid Columns
Visible in DetailsYes   Detail Columns
Visible in New RecordYes   * New Record Columns
Visible in Edit RecordYes   * Edit Columns
PHPLens: 4.9.2   Data: 0.02   DB: mysql   adodb: 4.62   Compat: 2   PHP: 5.2.17   OS: Linux
License Type: Enterprise   ID: (Natsoft;John Lim;   Valid Till: Never Expires


This feature is available since 3.1.

This demo show to create complaint records, retrieving the product id using a search form built into the NEW/EDIT record form. This is particularly useful when we have a 100,000 product table and we don't want to pull every product record in a normal lookup, but allow the user to enter the first few characters of the product name, then we perform a search.

The two key properties are:

$lens->lookupLens = 
	'PRODUCTID^#select productid,productname from products where productid={productid} ';

The lookupLens is used to perform the mapping between product and productid. We use a hot-update, instead of a regular lookup because we only want to retrieve the required records based on some search criteria, and not pull down 100,000 product records. Hot-updates begin with a #, and matched with the complaint record's {productid}.

$lens->searchInEditNew =
	"PRODUCTID^select concat('Product: ',productname),productname,productid 
		from products where productname like '{#}%'^>1";

There are two modes for searchInEditNew. The simpler first one is discussed in ex919. This example is when the search field is also a lookup, so we need to define a hot update lookupLens. This is because we don't want to display the productid in the search field, but the product name.

Now the searchInEditNew uses a SELECT SQL that retrieves 3 fields, the first being the text to display in the popup, the 2nd is the text to display after the popup item is selected, and the 3rd is what we actually store into the database record. The {#} is substituted with what the user entered in the input field.

And the ^>1 at the end of the searchInEditNew means the user must enter at least 1 character to perform a search. Also note that for this type of searchInEditNew, the field must be a mustFill field.

Lastly, this example has the details being displayed below the grid, using $lens->showRecNo = 5;

email: (change # to @)     telephone (malaysia): 60-3-7947 2888     fax (malaysia): 60-3-7947 2800