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 -> General/Other

 how to populate a list of checked rows (CheckBox_Delete) in an editable grid form?

Print topic Send  topic

Author Message
YxorPitna
Posted: 03/13/2004, 12:57 PM

[my current setup: CCS 2.2.3.60, Apache 1.3.29, PHP 4.3.4-2, MySQL 4.0.18-2]

hi everyone..

i have a simple editable grid which only allows deleting single or multiple rows..
that functionality is supported by the default editable grid CheckBox_Delete component, which exists on every row

the form works exactly as expected as when i check certain rows, and hit the delete button.. they get deleted alright..
though i'm trying to add an intermediate form between the form submission and the record deletion.. and that's where my nightmares started :-/
all i wanna do, is populate a list of all the checked rows, so i'd pass them over to my custom function which would then draw a form with certain warnings based on the data collected..

i spent about 6 hours straight on this to no avail..
somewhere in the original code, is a class containing all the functions related to my current form.
one of which is "Delete()" and that's where the data is finally extracted from the CheckBox_Delete properties into an SQL statement
$this->Where = "client_id=" . $this->ToSQL($this->CachedColumns["client_id"], ccsInteger);
(client_id is the value i'm after )
but that's a bit too late already, as i want my script to be triggered one step before that..
all the ideas i had involve extensively modifying the original code, which i'd rather leave as the fail-safe option..
one of my attempts got a little close to success as follows:
- added a custom function at the very end of the main form class.. right after Delete():
function CustomCheckBoxLookup($field)  
 {  
 global $custom_checkbox_value;  
  #$this->ds->next_record();  
  $custom_checkbox_value=$this->ToSQL($this->CachedColumns["$field"], ccsInteger);  
  #$this->close();  
  return $custom_checkbox_value;  
 }  
//End CustomCheckBoxLookup Method  
  
} //End clients_listDataSource Class @2-FCB6E20C  
- and added custom code that's triggered at 'BeforeBuildDelete' event:
// -------------------------  
 global $clients_list, $custom_checkbox_value;  
  	$clients_list->ds->CustomCheckBoxLookup("client_id");  
	echo $custom_checkbox_value;  
// -------------------------  
and commented out the SQL statement execution line the Delete function:
#$this->query($this->SQL);
this code sucessfully returns the ID of all the rows checked.. followed by an error ( headers related.. as the output is started by the page redirect after the form submission )

but i know deep down that it's so messy.. and is just a bad way to start with CCS as it breaks the original code already

any idea how to achieve this properly?
i checked the tutorials ( Updating Many-to-Many via CheckBox List and others ) as well as these forums.. but nothing seems to address the same issue

i'm surprised no one has had the same need/problem before..

any help would be greatly appreciated.. thanks in advance
YxorPitna
Posted: 03/14/2004, 1:14 PM

hmm.. not a single response!
i wonder if i'm trying to do the impossible.. because by far, none of the posts/tutorials i read explained how to do something similar..

if i was coding this by hand, i'd use an array for the checkbox name..
something like
<input type="checkbox" name="delete_unit[]" value="<?$unit_id?>">
that way, once a form is submitted.. the retrieved post variable $delete_unit is actually an array, with an amount of keys equivalent to the amount of boxes checked.. and each key maps to a row id ($unit_id in this case)

CCS doesn't allow using [] in control names.. so i'm pretty much stuck both ways

this has crippled me completely..
any responses will be greatly appreciated
thanks in advance
DonB
Posted: 03/15/2004, 7:06 AM

This would be a bit difficult to accomplish as the checkboxes for "delete"
are evaluated after the form gets submitted. Each row is processed in turn,
however there is a single Validate fired for the entire set of rows. I
think you could probably work out something by looking at the Update and
UpdateRow methods on the grid to see how CCS steps through the grid.

I think maybe you should try to determine the "deleteability" of each row
while it's being displayed (as part of the query or in the BeforeShowRow
event). You could either disable the delete checkbox or display an
additional column with text or a link to a page explaining the details of
the warnings you need related to the possible delete. This would be a much
cleaner way to handle it rather than trying to intercept the delete once it
has been submitted.

--
DonB

http://www.gotodon.com/ccbth


"YxorPitna" <YxorPitna@forum.codecharge> wrote in message
news:24054cb3766ffb@news.codecharge.com...
> hmm.. not a single response!
> i wonder if i'm trying to do the impossible.. because by far, none of the
posts/tutorials i read explained how to do something similar..
>
> if i was coding this by hand, i'd use an array for the checkbox name..
> something like
>
<input type="checkbox" name="delete_unit[]"  
value="<?$unit_id?>">
> that way, once a form is submitted.. the retrieved post variable
$delete_unit is actually an array, with an amount of keys equivalent to the
amount of boxes checked.. and each key maps to a row id ($unit_id in this
case)
>
> CCS doesn't allow using [] in control names.. so i'm pretty much stuck
both ways
>
> this has crippled me completely..
> any responses will be greatly appreciated
> thanks in advance
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

YxorPitna
Posted: 03/18/2004, 2:24 PM

thank you DonB for the response,
i guess i'll switch to a basic grid and add the delete functionality by hand, as that seems way easier than to decypher how CCS handles deleting records in an editable grid

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.

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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