• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Dynamically Assigned Checkbox Value

I am a relative beginner and need some help doing something pretty simple (or so I thought).

I have an XML file.  I want the page to create a dynamic table with checkboxes based on the XML file.  I was able to do that pretty easy using Spry.  However, I need to know how to dynamically assign the value of the checkbox to one of the fields in the row.

I will come up with a more permanent solution, but by the end of the day today, I need to come up with a makeshift solution for this. I simply need to pass the value of the checkbox to a perl script to display the list of selected checkboxes and then submit it via email.

Basically, everything works as I need it to, I just need to change the value of the checkboxes from "on" to an actual value.  Based on the XML file below, need the value to be assigned to either the "lot id#" or the "lot_no" which are the same value.  I currently am able to return an "on" for every checked checkbox (five checked, I get five "on" 's returned").

Thanks guys and girls!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Title</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/xpath.js" type="text/javascript"></script>
<script src="SpryAssets/SpryData.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
var ds1 = new Spry.Data.XMLDataSet("http://www.xxx.com/xxx.nsf/CTinv.xml", "inventory/lot");
//-->
</script>
</head>
 
<body bgcolor="#CCCCCC">
<h1>XXX</h1>
<h2>Lot Consumption Report</h2>
<hr width="600 px" color="#333333" align="left" />
<h3>Select the lots that have been consumed:<br /><br />
Nagatuk Material<br /></h3>
 
<FORM METHOD='POST' ACTION='/cgi-bin/cr3.pl'>
<div spry:region="ds1">
  <table width="506">
    <tr>
      <th width="29"></th>
      <th width="56">Lot_no</th>
      <th width="67">Shape</th>
      <th width="57">Size</th>
      <th width="67">Grade</th>
      <th width="48">Qty</th>
      <th width="57">Base</th>
      <th width="89">Shipped</th>
    </tr>
    <tr spry:repeat="ds1">
      <td><input type="checkbox" name="cb" /></td>
      <td>{lot_no}</td>
      <td>{shape}</td>
      <td>{size}</td>
      <td>{grade}</td>
      <td>{qty}</td>
      <td>{base}</td>
      <td>{shipped}</td>
    </tr>
  </table>
</div>
<input name="Submit" type="Submit" value="Submit" /><input type="reset" name="reset" value="Reset Form" />
</FORM>
</p>
</body>
</html>
 
 
 
XML FIle:
 
 
 
  <?xml version="1.0" ?> 
- <inventory>
- <lot id="019-479461">
  <lot_no>019-479461</lot_no> 
  <shape>RD</shape> 
  <size>1-11/16</size> 
  <grade>12L14</grade> 
  <qty>3,921</qty> 
  <base>0.4650</base> 
  <shipped>10/22/2008</shipped> 
  </lot>
- <lot id="019-479464">
  <lot_no>019-479464</lot_no> 
  <shape>RD</shape> 
  <size>1-11/16</size> 
  <grade>12L14</grade> 
  <qty>3,910</qty> 
  <base>0.4650</base> 
  <shipped>10/22/2008</shipped> 
  </lot>
- <lot id="019-479480">
  <lot_no>019-479480</lot_no> 
  <shape>RD</shape> 
  <size>1-11/16</size> 
  <grade>12L14</grade> 
  <qty>3,918</qty> 
  <base>0.4650</base> 
  <shipped>10/22/2008</shipped> 
  </lot>
- <lot id="019-479482">
  <lot_no>019-479482</lot_no> 
  <shape>RD</shape> 
  <size>1-11/16</size> 
  <grade>12L14</grade> 
  <qty>3,918</qty> 
  <base>0.4650</base> 
  <shipped>10/22/2008</shipped> 
  </lot>
- <lot id="019-479486">
  <lot_no>019-479486</lot_no> 
  <shape>RD</shape> 
  <size>1-11/16</size> 
  <grade>12L14</grade> 
  <qty>3,833</qty> 
  <base>0.4650</base> 
  <shipped>10/22/2008</shipped> 
  </lot>
- <lot id="019-479518">
  <lot_no>019-479518</lot_no> 
  <shape>RD</shape> 
  <size>1-11/16</size> 
  <grade>12L14</grade> 
  <qty>3,936</qty> 
  <base>0.4650</base> 
  <shipped>10/22/2008</shipped> 
  </lot>
  </inventory>

Open in new window

0
kevkline
Asked:
kevkline
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
0
 
kevklineAuthor Commented:
Just wanted to update this.  Simple fix.  Simply added this code as the value for the checkbox within the spry:repeat:

value="{ds1::lot_no}"

0
 
Michel PlungjanIT ExpertCommented:
Ah, I thought you wanted to choose which one
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now