This topic is locked

Field Validation - Required Fields

7/16/2006 6:45:30 PM
PHPRunner General questions
W
warrenk author

I setup some fields as required fields. When I try to add a record without filling in the fields, I get a popup window saying the fields are required...then it adds the record anyways. I do have a event setup before the record is added and am wondering if the event is resetting a error flag or something? If I use a event to check for duplicate records, do I have to do all edit checking in here?
Here is my be event...
function BeforeAdd(&$values)

{
// Parameters:

// $values - Array object.

// Each field on the Add form represented as 'Field name'-'Field value' pair
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select * from brands where brand_pname=".$values["brand_pname"]. " or brand_name =".$values["brand_name"];

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

// if record exists do something

echo $values["brand_name"]. " or " .$values["brand_pname"]. "already exists in Brands Master";

return false;

}

else

{

// if dont exist do something else

}
return true;
// return true if you like to proceed with adding new record

// return false in other case
}

Alexey admin 7/17/2006

Hi,
your event code doesn't conflict with "Required" validation.
Could you give me a URL to your Add page where I can see the validation not working properly ?

Send it to support@xlinesoft.com
Or please zip and send to support@xlinesoft.com a full set of generated PHP pages aling with your database creation script. I'll find what's wrong running your project on my test box.

W
warrenk author 7/17/2006

Alexey,
I must of been working to long yesterday. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=9877&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> I am testing this issue today and everything is working just fine. If I have any problems, I will let your know.
By the way...this product is great! This will be the second product I will purchase from your company (I purchased the DB to HTML Express) and have no doubt PHP Runner will also be worth it.
Plus the support is second to none...great job!
Warren

Hi,

your event code doesn't conflict with "Required" validation.
Could you give me a URL to your Add page where I can see the validation not working properly ?

Send it to support@xlinesoft.com
Or please zip and send to support@xlinesoft.com a full set of generated PHP pages aling with your database creation script. I'll find what's wrong running your project on my test box.