Dynamically Assigned Checkbox Value

Posted on 2008-11-04
Last Modified: 2010-05-18
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" "">

<html xmlns="" xmlns:spry="">


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<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("", "inventory/lot");




<body bgcolor="#CCCCCC">


<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>


<div spry:region="ds1">

  <table width="506">


      <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 spry:repeat="ds1">

      <td><input type="checkbox" name="cb" /></td>











<input name="Submit" type="Submit" value="Submit" /><input type="reset" name="reset" value="Reset Form" />






  <?xml version="1.0" ?> 

- <inventory>

- <lot id="019-479461">









- <lot id="019-479464">









- <lot id="019-479480">









- <lot id="019-479482">









- <lot id="019-479486">









- <lot id="019-479518">










Open in new window

Question by:kevkline
    LVL 75

    Accepted Solution


    Author Comment

    Just wanted to update this.  Simple fix.  Simply added this code as the value for the checkbox within the spry:repeat:


    LVL 75

    Expert Comment

    by:Michel Plungjan
    Ah, I thought you wanted to choose which one

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
    In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now