CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Need code location for editable grid problem

Print topic Send  topic

Author Message
pkrawetz

Posts: 77
Posted: 06/08/2004, 10:37 AM

ghtracy - You provided advice on changing the insertallowed to false when you have a prefilled field on an updatable grid. I tried this code in different spots but couldn't get it to work. Now new rows are ignored. I'm using PHP as the language. I need to know what event to place the code under
View profile  Send private message
ghtracey

Posts: 23
Posted: 06/08/2004, 11:21 AM

There are a couple of ways of doing this. The first is to do a test in the BeforeExecuteInsert event. If the prefilled field is the only field containing data, set the form->InsertAllowed = False. Depending on the number of fields in your form, this could require a fairly large check. Also, if you have required fields, most likely every time you try to change one record in the grid, the validation will throw errors regarding required fields not being filled, which requires you to unset the prefilled fields in the blank record during an update. As you can see, this is a bit of a hassle.

What I eventually did, was to modify the Insert Method for the form, and recode the portion that creates the insert. I leave the hidden form field blank and only fill it when an insert is actually being performed. This gets you around all the testing and having to use InsertAllowed.

For example, I have an editable grid in one application that allows you to enter items into a table that is keyed using a field boxID, which is used as the paramter for the boxes select. I need this field to exist in order to do an insert, but it is not to be changed by the user. Presetting the hidden field causes all the problems mentioned above, so in the Insert Method, I replaced
. $this->ToSQL($this->boxID>GetDBValue(), $this->boxID>DataType) . ", "
with
. $this->ToSQL(CCGetParam("box"), $this->boxID->DataType) . ","

Problem solved without any complicated checks. Give that a try.
_________________
Graham Tracey
Council of Yukon First Nations
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.