This topic is locked

List of Checkboxes with query result

10/22/2009 6:09:49 PM
PHPRunner General questions
M
mlichtenstein2 author

I am new to phprunner and would like to be able to use a check boxes to make multiple selections with the results from a query.

I made this all work but I edited the [table]list.php file after getting the [table]*.php files started with phprunner.

However, if phprunner is used it will over write the files I edited so I am trying to either put these changes into phprunner

or have the ability to overide the phprunner created files the way the htm file can do so by placing it in the visual directory.

The file called pmid_comparison_list.htm creates a list of check boxes with the data from a query:
<!-- Create checkboxes on the wbselement fields -->

<td valign=middle class=borderbody>

<input type=checkbox name="selection[]" value="{$row.1keyblock}" id="check{$row.1recno}">

</td>
<td valign=middle class=borderbody {$row.1wbselement_style}>
{$row.1wbselement_value}
&nbsp;
</td>
....
<!-- Create the Move Selected button in the second panel with search buttons -->

<span class=buttonborder><input disptype="control1" class=button type=button value="Move Data From Temp Tables" onclick="var c=0; if(frmAdmin.elements['selection[]'].length==undefined && frmAdmin.elements['selection[]'].checked) c=1; else for (i=0;i<frmAdmin.elements['selection[]'].length;++i) if (frmAdmin.elements['selection[]'][i].checked) c=1; if(c==0) return true; frmAdmin.submit(); frmAdmin.action='pmid_comparison_list.php'; frmAdmin.target='_self';"></span>
When the query is made, it creates code with "value=''" and I receive an array with empty values. I made this work outside of phprunner

by editing the file called pmid_comparison_list.php. I have two types of queries on the screen and set the id depending on if a pull down selection was made:
if ($_POST['tfaid'] > 0)

{

//echo "loading keys with subtfaid ". $data["subtfaid"]. "
";

$row[$col."id1"]=htmlspecialchars($data["subtfaid"]);

$keyblock.= rawurlencode($data["subtfaid"]);

$row[$col."keyblock"]=htmlspecialchars($keyblock);

$row[$col."recno"] = $page->recno;

// edit page link

} else {

$row[$col."id1"]=htmlspecialchars($data["wbselement"]);

$keyblock.= rawurlencode($data["wbselement"]);

$row[$col."keyblock"]=htmlspecialchars($keyblock);

$row[$col."recno"] = $page->recno;

}
My question is how can I do the same thing via phprunner OR is there a way to use my existing files that work and de-select the

table "pmid_comparison" in phprunner. If I deselect the table in phprunner, then the code will bomb on lines with:

$tablename = $this->table->GetName();
Therefore, if I deselect the table in phprunner, I would need a way to add the table entry in my code so that it will work.

I know that I can hardcode some of the code to have ($tablename = "pmid_comparison") but there were so many other places where

it is needed.
Have others been successfull with this approach of editing the [table]_list.php file manually and make it overide the one

phprunner builds the way the [table]_list.htm file can overide phprunner by placing it in the visual directory?
Thank you,
Mark Lichtenstein

mlichtenstein2@earthlink.net

M
mlichtenstein2 author 10/23/2009

My checkbox question has been resolved.

An office collegue showed me how to create an event (doevent) in the htm file

on the checkbox.

The htm file has the doevent name="generateCheckboxKey":
{$row.shadeclass} {$row.rowstyle}><!--{if $column1show}-->

<TD width=13>&nbsp;</TD><!-- Create checkboxes on the wbselement fields -->{doevent name="generateCheckboxKey" recno=$row.1recno wbs=$row.1wbselement_value subtfa=$row.1subtfaid_value}

<TD class=borderbody vAlign=middle width=138 {$row.1wbselement_style}>{$row.1wbselement_value}&nbsp;&nbsp; </TD>

<TD class=borderbody vAlign=middle width=122 {$row.1tfaid_style}>{$row.1tfaid_value}&nbsp;&nbsp; </TD>

<TD class=borderbody vAlign=middle width=122 {$row.1subtfaid_style}>{$row.1subtfaid_value}&nbsp;&nbsp; </TD>
Then, inside the event I have the following code to associate the checkbox key with either the subtfa parameter or the wbs parameter:
function generateCheckboxKey(&$params)

{

echo "<TD class=borderbody vAlign=middle><INPUT id=check".$params['recno'].

" type=checkbox value='";

if(@$_SESSION['tfaid'] > 0)

echo $params['subtfa'];

else

echo $params['wbs'];
echo "' > </TD>";
}