You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Moore <jo...@jmsd.co.uk> on 2004/05/03 15:30:06 UTC
Setting html:text readonly attribute
I'm having a big problem trying to dynamically set a value for the readonly
attribute of an <html:text> tag. I'm using a JSTL core tag to try to set it
and whatever I do is ignored.
In the example below, the newPurchase property is a boolean. If I use
exactly this tag elsewhere on the page, it outputs true or false as
expected. Here, though, it has no effect on the attribute, whether
newPurchase is true or false - the input tag generated is missing the
'readonly' attribute.
<html:text property="licenceCount" size="3" readonly="<c:out
value='${purchaseForm.newPurchase}'/>" maxlength="5"/>
I've also tried the following (with as little effect), using an escaped
double-quote instead of a single quote:
<html:text property="licenceCount" size="3" readonly="<c:out
value=\"${purchaseForm.newPurchase}\"/>" maxlength="5"/>
The curious thing is that I can use a similar construct but with an integer
property to dynamically set other attributes, such as size, as in the
following example (ignore the logical nonsense of assigning a size on such
a basis, it's just a test of technical feasibility):
<html:text property="licenceCount" size="<c:out
value=\"${purchaseForm.totalLicences}\"/>" maxlength="5"/>
Is there something to do with assigning boolean attributes in these tags
which I haven't got yet? Or is it just soemthing weird with the readonly one?
John
=============================================
John Moore - Norwich, UK - john@jmsd.co.uk
=============================================
Re: Setting html:text readonly attribute
Posted by John Moore <jo...@jmsd.co.uk>.
At 16:08 03/05/2004, Jason Miller wrote:
>Actually, you can't use a tag as the value of another tag's attribute.
Out of interest, does anyone know whether there are plans for this for a
future JSP version? It seems quite an obvious requirement, and I can't see
any technical reason why it should not be possible. It would surely be easy
to establish an order of evaluation (the nested tags get evaluated first).
John
=============================================
John Moore - Norwich, UK - john@jmsd.co.uk
=============================================
Re: Setting html:text readonly attribute
Posted by Jason Miller <ja...@danteconsulting.com>.
Actually, you can't use a tag as the value of another tag's attribute.
If you use the html-el taglib you can do something like this:
<html:text property="licenceCount" size="3"
readonly="${purchaseForm.newPurchase}" maxlength="5"/>
John Moore wrote:
> I'm having a big problem trying to dynamically set a value for the
> readonly attribute of an <html:text> tag. I'm using a JSTL core tag to
> try to set it and whatever I do is ignored.
>
> In the example below, the newPurchase property is a boolean. If I use
> exactly this tag elsewhere on the page, it outputs true or false as
> expected. Here, though, it has no effect on the attribute, whether
> newPurchase is true or false - the input tag generated is missing the
> 'readonly' attribute.
>
> <html:text property="licenceCount" size="3" readonly="<c:out
> value='${purchaseForm.newPurchase}'/>" maxlength="5"/>
>
> I've also tried the following (with as little effect), using an escaped
> double-quote instead of a single quote:
>
> <html:text property="licenceCount" size="3" readonly="<c:out
> value=\"${purchaseForm.newPurchase}\"/>" maxlength="5"/>
>
> The curious thing is that I can use a similar construct but with an
> integer property to dynamically set other attributes, such as size, as
> in the following example (ignore the logical nonsense of assigning a
> size on such a basis, it's just a test of technical feasibility):
>
> <html:text property="licenceCount" size="<c:out
> value=\"${purchaseForm.totalLicences}\"/>" maxlength="5"/>
>
> Is there something to do with assigning boolean attributes in these tags
> which I haven't got yet? Or is it just soemthing weird with the readonly
> one?
>
> John
>
>
> =============================================
> John Moore - Norwich, UK - john@jmsd.co.uk
> =============================================
>
>
> ------------------------------------------------------------------------
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.662 / Virus Database: 425 - Release Date: 20/04/2004
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org