Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Simon Greener: "A lot of work went in to designing our application database. PHP Generator allowed us to build a fully functional, professional looking, and functionally powerful web application from that database. It has freed us from worrying about low level code, enabling us to focus on the business requirements of the customer. The support provided is excellent with staff quickly producing answers to questions ranging from newbie to simple or complex. I highly recommend the product".
Anley Lafleur: "I cannot wait to start using your exciting product and I am sure it will help me achieve my objectives".

More

Add your opinion

PostgreSQL PHP Generator online Help

Prev Return to chapter overview Next

OnInsertFormValidate

This event occurs before submitting of an insert form. It allows you to detect errors on the client side before the form is submitted to the server to avoid the round trip of information necessary for server-side validation. Live example.

 

Signature:

function OnInsertFormValidate (fieldValues, errorInfo)

 

Parameters:

fieldValues

An associative array of values containing user input. To access the value of the editor of the column_name column, use the field_values['column_name'] syntax.

errorInfo

The object that provides interface (the SetMessage method) to set a validation error message.

 

Example 1:

The code below demonstrates the verification of the percent number on the record inserting.

 

if (fieldValues['percents'] < 0 || fieldValues['percents'] > 100)

{

    errorInfo.SetMessage('Percent value should be between 0 and 100.'); 

    return false;

}

 

Example 2:

The following code is used in the NBA demo project to ensure that home and away teams are different for an inserted game:

 

if (fieldValues['home_team_id'] == fieldValues['away_team_id'])

{

  errorInfo.SetMessage('Home and away teams must be different');

  return false;

}

 

See also: OnEditFormValidate



Prev Return to chapter overview Next