You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "bphillips@ku.edu" <bp...@ku.edu> on 2013/07/31 16:22:56 UTC
Freemarker Template Issue For Select Tag When Multiple is True
Please see: https://issues.apache.org/jira/browse/WW-4153 which I'm working
on.
I thought about modifying template/simple/select.ftl to:
<#assign i = 1 >
<#if parameters.multiple?default(false)>
<#if (parameters.id?? && parameters.name??)>
<input type="hidden" id="__multiselect_${parameters.id?html}"
name="__multiselect_${parameters.name?html}" value=""<#rt/>
</#if>
<#if (parameters.id?? && !parameters.name??)>
<input type="hidden" id="__multiselect_${parameters.id?html}"
name="__multiselect_${parameters.id?html}" value=""<#rt/>
</#if>
<#if ( !parameters.id?? && parameters.name??)>
<input type="hidden" id="__multiselect_${parameters.id?html}"
name="__multiselect_${parameters.id?html}" value=""<#rt/>
</#if>
<#if ( !parameters.id?? && !parameters.name??)>
<input type="hidden" id="__multiselect_${i}" name="__multiselect_${i}"
value=""<#rt/>
<#assign i = i + 1>
</#if>
<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>
</#if>
/>
</#if>
But I think my solution will not work if the user has 2 or more select
inputs with multiple="true" and no name and no id attribute specified. I
think both would get a name value of __multiselect_1
Any suggestions would be appreciated for how to create a unique id and name
value for the hidden input type when the user uses a select input type with
multiple="true" and no name and no id attribute is specified.
Bruce
--
View this message in context: http://struts.1045723.n5.nabble.com/Freemarker-Template-Issue-For-Select-Tag-When-Multiple-is-True-tp5713372.html
Sent from the Struts - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Freemarker Template Issue For Select Tag When Multiple is True
Posted by Lukasz Lenart <lu...@apache.org>.
2013/7/31 bphillips@ku.edu <bp...@ku.edu>:
> Please see: https://issues.apache.org/jira/browse/WW-4153 which I'm working
> on.
>
> I thought about modifying template/simple/select.ftl to:
>
> <#assign i = 1 >
> <#if parameters.multiple?default(false)>
> <#if (parameters.id?? && parameters.name??)>
> <input type="hidden" id="__multiselect_${parameters.id?html}"
> name="__multiselect_${parameters.name?html}" value=""<#rt/>
> </#if>
> <#if (parameters.id?? && !parameters.name??)>
> <input type="hidden" id="__multiselect_${parameters.id?html}"
> name="__multiselect_${parameters.id?html}" value=""<#rt/>
> </#if>
> <#if ( !parameters.id?? && parameters.name??)>
> <input type="hidden" id="__multiselect_${parameters.id?html}"
> name="__multiselect_${parameters.id?html}" value=""<#rt/>
> </#if>
> <#if ( !parameters.id?? && !parameters.name??)>
> <input type="hidden" id="__multiselect_${i}" name="__multiselect_${i}"
> value=""<#rt/>
> <#assign i = i + 1>
> </#if>
> <#if parameters.disabled?default(false)>
> disabled="disabled"<#rt/>
> </#if>
> />
> </#if>
>
> But I think my solution will not work if the user has 2 or more select
> inputs with multiple="true" and no name and no id attribute specified. I
> think both would get a name value of __multiselect_1
>
> Any suggestions would be appreciated for how to create a unique id and name
> value for the hidden input type when the user uses a select input type with
> multiple="true" and no name and no id attribute is specified.
Maybe do it simple - if there is neither "id" nor "name" just use
default("") as it doesn't make sense to generate hidden fields for
tags that wont be send back to server. Or even add global <#if> to
remove the whole section.
Regards
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org