CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Editable Grid - suppress validation on a row

Print topic Send  topic

Author Message
clahti2

Posts: 107
Posted: 02/21/2012, 2:55 PM

Hello all:

I have an editable grid with a checkbox tied to a datafield called register(tinyint). There are several listboxes and textboxes on the grid as well. I would like to only update the database if the register checkbox is marked, which I have accomplished with the following code in the BeforeBuildUpdate section:

  
if ($grid->register->GetValue() <> 1) {  
	$grid->DataSource->CmdExecution = false;  
}  

This works fine however the problem is that even though updates are suppressed if the register checkbox is not marked, I still get validation errors on required fields for the remaining rows that I do not want to update. Basically I need to suppress both row validation and row update if the register checkbox is not marked.

Thanks!
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 02/21/2012, 4:04 PM

clahti2,

This might be a good question for support ( http://support.yessoftware.com/ ). I have never had a need to do this. Also, if you get a answer please post it hear. Thanks.
View profile  Send private message
Lucius

Posts: 220
Posted: 02/25/2012, 10:04 AM

clahti2, did you send this question to support, and if yes have you received an answer?

I am also very interested in how you can override/suppress validation in editable grid.
View profile  Send private message
MichaelMcDonald

Posts: 640
Posted: 02/25/2012, 3:05 PM

Some ideas....

Don't use "required" validation from the properties inspector.
Instead, use custom code in the on validate event. This might have to be in the row on-validate event, I haven't tried your request specifically, but the concepts here will work.

For an editable grid, you most likely won't have to specify whether the grid is or isn't in EditMode, so you could probably use a simple on validate event custom code like:

$checkbox = $editablegridname->checkbox->GetValue();

If ($checkbox != 1) {
$editablegridname->errorsAddError("Value is required");
}

Which says get the value from the checkbox, and if the check box value is NOT 1, it must be something else, so throw an error message to the editable grid. So if the default unticked value is 1, it will skip the validation.

-------------------------------------------------------------------------------------------------------------------
(! $containername->EditMode) means Add Mode,
($containername->EditMode) means Submit/Delete Mode

So, If you are adding a record using a normal record form, try something like:

$checkbox = $container->checkbox->GetValue():

if (! $recordformname->EditMode){
If ($checkbox !=1){
$recordformname->errorsAddError("Value is required");
}
}

Of you are updating a record using a normal add/update/delete form, try something like:

$checkbox = $recordformname->checkbox->GetValue():

if ($recordformname->EditMode){
If ($checkbox !=1){
$recordformname->errorsAddError("Value is required");
}
}

(keep in mind the interchanged use of $container and $recordformname for the form name in these examples)

_________________
Central Coast, NSW, Australia.

View profile  Send private message
clahti2

Posts: 107
Posted: 02/27/2012, 3:18 PM

Thanks for the feedback, I have been away a few days so will try your suggestion and report back here my findings :)

Thanks again.
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.

MS Access to Web

Convert MS Access to Web.
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.