[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Checkboxes in XSLT

Subject: Re: Checkboxes in XSLT
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Sun, 21 Nov 2004 21:29:17 +0100
xslt checkbox name
Jen Jiang wrote:
I have checkboxes in my xslt file like this:

<xsl:element name="input">
<xsl:attribute name="type">checkbox</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of
select="$questionid"/>[1]</xsl:attribute>		
<xsl:attribute name="value">1</xsl:attribute>
<xsl:value-of select="QUERESPONE"/>
</xsl:element>
....
There are 5 more. The values of the checked boxes got
passed but for unchecked boxes I got "undefined
offset" when trying to get the values in PHP.

Is my code wrong?

Well, at a first glance it is unnecessary verbose. It could be written in a more compact form: <input tyep="checkbox" name="{$questionid}[1]" value="1">QUERESPONE</input>

Assuming the variable $questionid holds the value "foo" this
would evaluate to
 <input tyep="checkbox" name="foo[1]" value="1">QUERESPONE</input>
which is unusual and probably illegal HTML (an input element should
be empty). At least, the widget name should not contain brackets,
which I suspect causes your problems with PHP later.

Solution: think *hard* how the HTML should look like, *then* write
a style sheet which produces the HTML (check carefully whether it
does), and only after this step go on with further processing of
the form values.


J.Pietschmann


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.