aslsondrio
Posts: 5
|
Posted: 05/22/2008, 7:01 AM |
|
Hi all, I have a problem with an editable grid which I can't resolve by myself.
The grid usually contains at least 2 record, and I want to leave only one blank row for inserting. (Empty Rows = 1).
Each record MUST have all of its fields filled, and only the last one (the rightmost one) must remain freely editable, while the other two fields can only contain two predeterimed values.
Thus I chose to pre-set the default values of the two "fixed" fields.
This causes my problem, in fact the editable grid "sees" the two filled fields on the last row, and "thinks" I want to insert the record.
It tries but fails because the third field is empty (either because it's set as "Required" or because in the MySQL table it doesn't allow nulls).
This failure to insert of the last row prevents the editable grid to do the updates I have done to the two first rows (which are always present).
What I tried to do instead, is to force the editable grid to ignore the last row until the third field is filled.
If I don't fill it the editable grid must ignore the last row and do only the updates I've done to the first two rows.
I can provide the code for all the attempts I made, but I'd like to know a fresh opinion from more expert people on the feasibility of what I'm trying to do; also, it's already a very long post and I don't want to make it even longer!
Thank you in advance,
Michele
|
|
|
wkempees
Posts: 1679
|
Posted: 05/22/2008, 7:40 AM |
|
quick answer
You can set InsertAllowed, UpdateAllowed to false.
None of the actions will be performed.
Upon submit you do some checking of you own and set InsertAllowed, Updateallowed as per your requirments.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
|
|
aslsondrio
Posts: 5
|
Posted: 05/22/2008, 9:13 AM |
|
Quote wkempees:
quick answer
You can set InsertAllowed, UpdateAllowed to false.
None of the actions will be performed.
Upon submit you do some checking of you own and set InsertAllowed, Updateallowed as per your requirments.
Walter
Thanks for the input!
This morning I had already tried this method but with little success; I was able to block the insert but then the empty row disappeared and I could not make it reappear without closing and reopening the page again. (and I *did* try to re-set the "InsertAllowed" property to true with buttons, but it just didn't work).
Anyway since you proposed the same idea, I decided to re-try again from scratch.
It seems I always used the wrong event!
I had tried the instruction in different places:
If ( $radreply->Value->GetValue() == "") {
$radreply->InsertAllowed = false;
}
If I put it in various events like the following it will not work.
- On Validate
- On Validate Row
- Before Submit
- After Submit
- Before Build Insert
- Before Execute Insert
Instead if I put these lines in the field's "On Validate" event it just works!
Well, I'll have to remember this one!
THANK YOU!
Michele
|
|
|
wkempees
Posts: 1679
|
Posted: 05/22/2008, 9:50 AM |
|
Nice, another one served. (@ Tony)
Glad it did it for you!
Happy charging, please adjust the title to [Resolved] or even [ TIP:] + original headingtext.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
|
|
|