FERAD
Posts: 51
|
Posted: 08/09/2006, 6:10 AM |
|
I have an editable grid with 3 empty rows. No data has been entered or changed. If the submit button is pressed, it adds a new record to the database regardless. How can I control whether a record is to be updated or not.
I have even added to the Before Build Insert event the following code:
$items->InsertAllowed = false; (php)
I wanted to see if this would stop the blank record from being inserted but it always inserts 1 record.
Your help would be greatly appreciated, thanks in advance.
|
|
|
mamboBROWN
Posts: 1713
|
Posted: 08/09/2006, 6:17 AM |
|
FERAD
By any chance does your editable grid have default values set?? Are you validating your input fields??
|
|
|
FERAD
Posts: 51
|
Posted: 08/09/2006, 6:23 AM |
|
All the fields are blank with no defaults. If I add a default value to any of the fields I get 3 records added instead of 1. This is because I show 3 blank rows. If I change the number of blank rows to 1, I still get 1 recorded added regardless of the number of blank rows.
|
|
|
mamboBROWN
Posts: 1713
|
Posted: 08/09/2006, 6:31 AM |
|
FERAD
Are you validating your fields to see if they are empty??
|
|
|
FERAD
Posts: 51
|
Posted: 08/09/2006, 6:44 AM |
|
No Validation
|
|
|
jres
|
Posted: 08/09/2006, 7:04 AM |
|
FERAD,
do you use checkbox in row?
|
|
|
FERAD
Posts: 51
|
Posted: 08/09/2006, 7:09 AM |
|
All the fields are textboxes with one listbox (no value selected). When I check the database all fields show NULL value. The only thing with the database is there is one autoincrement field. I even changed the listbox to textbox as well.... same problem.
I even tried to remove the autoincrement field from the database... same problem.
Setup Custom Insert for the table. This worked.
Thanks for the responses.
|
|
|
jres
|
Posted: 08/09/2006, 8:53 AM |
|
I understand your initial problem:
$items->InsertAllowed = false;
can't be used in BeforeBuildInsert event
you can use it in BefoeInsert event or onValidate event.
|
|
|