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

 Need some help with GRID Checkbox & Reports

Print topic Send  topic

Author Message
WebStudioSC

Posts: 7
Posted: 03/26/2012, 9:12 PM

I have a grid where i put checkboxes beside each row. I want to be able to print a report for each row that has a checkbox checked.

Can someone advise me on how I can check my grid to see which row has a check or not and then somehow send it to my report?

Thanks...
View profile  Send private message
clahti2

Posts: 107
Posted: 03/29/2012, 11:18 AM

Quote WebStudioSC:
I have a grid where i put checkboxes beside each row. I want to be able to print a report for each row that has a checkbox checked.

Can someone advise me on how I can check my grid to see which row has a check or not and then somehow send it to my report?

Thanks...

You can do this with javascript, have a look at this link to get you started:

http://www.blog.highub.com/javascript/javascript-core/j...x-array-values/
View profile  Send private message
Lucius

Posts: 220
Posted: 03/30/2012, 4:59 AM

You could also create a Editable Grid, when one column has this checkbox next to each row.

Implement a button "generate report". When it is pressed the grid is submitted, but instead of usual inser/update/delete you would display this custom report page as a preview (the checkbox name for each row can include your row ID, so you will know which were checked after submit).

User then can print this page or you can add a "print" button in some place.
View profile  Send private message
raphaelbiz

Posts: 10
Posted: 03/30/2012, 5:52 AM

i do it en jquerys in codecharge.


lets go..

1 - in your grid create 2 fields(1 hidden and 1 checkbox)

2 - in hiden field attbute id in souce data->control

3 - in checkbox format->id = {id}, value= {id}

4 - put on format->events-> onclick = ativar(this.value,'products','active');
(in this case lets charge the field active for 0 or 1 fro mtable products )

5 - put this script in html page.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
//funcao para ativar desativa itens
function ativar(valor,tabela,campo){

$.post("ativar.php", {
valor: valor,
tabela: tabela,
campo: campo
});

}
</script>

5 - create a php file:

<?php
session_start();
include("conexao.php");

//recebe valor
$valor = $_POST["valor"];

//recebe tabela
$tabela = $_POST["tabela"];

//recebe qual campo vai receber
$campo = $_POST["campo"];

//faz consulta no banco e verifica o escravo
$consulta = mysql_query("SELECT * FROM $tabela WHERE id = $valor");
$linha = mysql_fetch_array($consulta);

//atualiza
if ($linha[$campo]==1){
$query = mysql_query("UPDATE $tabela SET $campo = '' WHERE id =$valor LIMIT 1 ");
echo "não";
}else{
$query = mysql_query("UPDATE $tabela SET $campo = '1' WHERE id =$valor LIMIT 1 ");
echo "sim";
}

?>


_________________
linuxell.serveftp.com
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.