:: Forum >> Version 2 >>

Setting a value to selected checkbox

I have a widget in there i have people who all have PeopleID's in my database and i am displaying those people. I am using checkboxes so that i can select any number of people so as to export them using reports.
How do i assign a selected checkbox to a value for instance if i select John, i would like the checkbox to then have John's ID inside it.

Any assistance would be greatly appreciated
Roger Mutangadura
Tuesday, September 12, 2006
Please find below the file i am currently using. Its a PHP/Smarty file. So i would like that when i selected person, the the seleced person's id is added to an array of selected ID's so that i can export them and use them in another file to generate reports only for these selected people.

<link href="ActiveWidgets/runtime/styles/xp/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="ActiveWidgets/runtime/lib/aw.js"></script>
<style>
.aw-controls-grid {height: 100%; font: menu;}

.aw-column-0 {width: 40px;}
.aw-column-1 {width: 250px; }
.aw-column-2 {width: 210px; }
.aw-column-3 {width: 250px; }

.aw-grid-cell {border-right: 1px solid #b7c0c7;}
.aw-grid-row {border-bottom: 1px solid #b7c0c7;}

.aw-header-0 .aw-item-box {
background: #e0dde7!important;
}
.aw-grid-control {
font: menu; color: #000;
}
</style>
<script type="text/javascript">
var Data= new Array();
var myData = new Array();

{* section name=pub loop=$pubs *}
Data[{*%pub.index%*}] = [ "","{* $pubs[pub].Surname *}, {* $pubs[pub].Title *}{* $pubs[pub].Name *}&nbsp;({* $pubs[pub].Job *})","{* $pubs[pub].publication *}","{* $pubs[pub].CompName *}&nbsp;({* $pubs[pub].BName *})"];
{* /section *}
var Columns= ["&nbsp;","Name","Publication","Company"];
</script>
<script>

var obj = new AW.UI.Grid;

var str = new AW.Formats.String;
var num = new AW.Formats.Number;


obj.setColumnCount(Columns.length);
obj.setHeaderText(Columns);

//Checkboxes
obj.setCellTemplate(new AW.Templates.Checkbox, 0);
checkbox = new AW.UI.Checkbox;

var num_rows = obj.getRowCount();
checkbox.onControlValueChanged = function(value){
for (i=0; i<num_rows; i++){
obj.setCellValue(value,0,i);
}
obj.refresh();
};


var str = new AW.Formats.String;
var num = new AW.Formats.Number;

obj.setCellFormat([str,str,str]);
obj.setRowCount(Data.length);

obj.setCellText(Data);
obj.setSize(window.innerWidth-20,window.innerHeight-100);
obj.setSelectorVisible(false);



document.write(obj);


</script>
<form action="reportsexp.php" method="post">
<input type="submit" name="submit" value="Export list of selected persons">
</form>
Roger Mutangadura
Tuesday, September 12, 2006



This topic is archived.

Back to support forum

Forum search