materix
|
| Posted: 06/20/2005, 4:09 AM |
|
Hi.
I have an editable grid form with one empty row.
On each row there are some hidden input-fields, containing various default values.
My problem is that because these hidden-fields are set, then the empty row is submitted as a new record, even all visible fields are empty.
Is there any workaround this issue?
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 06/20/2005, 4:14 AM |
|
Possible solution would be to not assign any default values to hidden fields. It may be best to assign values to them after the form is submitted, not before.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
matt
|
| Posted: 07/11/2005, 5:18 PM |
|
I have the same problem and have not found a way around it. Peter R., can you post specific code demonstrating how to do this? You would save me much time and frustration.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/12/2005, 12:21 AM |
|
Hmm, my solution requires simply assigning values to fields/controls.
This is shown in a lot of examples, and also explained in the documentation: http://docs.codecharge.com/studio/html/ProgrammingTechn...ntrolValue.html
You'd place your code in the Before Build Insert or Before Execute Insert event. I haven't tested which one would work better, but both happen after the form is submitted.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
matt
|
| Posted: 07/12/2005, 9:36 AM |
|
The problem that I've found with trying to modify the controls at "before ... insert" time is that it appears that the values from the controls have already been bound to the internal variables used in constructing the inserts. Modifying their values at this point has no impact on the values which go into the insert statement. It's possible that I was doing something wrong, which is why I asked for a working example. I've already burned many hours on this and have pretty much given up. I'll try once more and post the results later today.
|
|
|
 |
wkempees
|
| Posted: 07/12/2005, 10:38 AM |
|
http://forums.yessoftware.com/posts.php?post_id=60507
in "Tips and Solutions"
Might help ?
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/12/2005, 11:26 AM |
|
Sorry, didn't have time to test this, so my answer was generic. This really should work though - in Before Build Insert and Before Build Update use:
$EditableGridName->ds->ControlName->SetValue("some value");
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
matt
|
| Posted: 07/12/2005, 2:47 PM |
|
Thank you Peter. As follow-up, it was a bonehead error on my part. I had coded :
$editablegrid->controlname->SetValue(...)
rather than :
$editabelgrid->ds->controlname->SetValue(...)
The "->ds" made the difference.
Matt
|
|
|
 |