You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Halil Karakose <ha...@gmail.com> on 2010/08/18 12:26:35 UTC
Empty option in Select Component
Hi all,
I am using select component in my aplication as follows:
<t:select t:id="mayAttributeValueSelect" value="attributeValues"
model="multiValuedAttributeSelectModel" size="5" style="width: 150px"
multiple="true"/>
But, even though my model doesn't contain any options, it renders as
follows:
<select style="width: 150px;" multiple="true" size="5"
id="mayAttributeValueSelect_0" name="mayAttributeValueSelect_0">
<option value=""></option> <!--This option is not supposed to be here-->
</select>
Following is my select model:
public class ListSelectModel extends AbstractSelectModel {
private List<OptionModel> options;
public ListSelectModel(List<String> optionList) {
options = new ArrayList<OptionModel>();
for (String s: optionList) {
options.add(new OptionModelImpl(s, s));
}
}
@Override
public List<OptionGroupModel> getOptionGroups() {
return null;
}
@Override
public List<OptionModel> getOptions() {
return options;
}
}
Am I missing something here?
Thanks....
Re: Empty option in Select Component
Posted by Halil Karakose <ha...@gmail.com>.
Sorry for nagging the mailing list. I've found the answer. I changed my
select component code as follows:
<t:select t:id="mayAttributeValueSelect" value="attributeValues"
model="multiValuedAttributeSelectModel" *blankOption="NEVER"* size="5"
style="width: 150px" multiple="true"/>
(See
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html
)
On Wed, Aug 18, 2010 at 1:26 PM, Halil Karakose <ha...@gmail.com>wrote:
> Hi all,
> I am using select component in my aplication as follows:
>
> <t:select t:id="mayAttributeValueSelect" value="attributeValues"
> model="multiValuedAttributeSelectModel" size="5" style="width: 150px"
> multiple="true"/>
>
> But, even though my model doesn't contain any options, it renders as
> follows:
>
> <select style="width: 150px;" multiple="true" size="5" id="mayAttributeValueSelect_0" name="mayAttributeValueSelect_0">
> <option value=""></option> <!--This option is not supposed to be here-->
>
> </select>
>
> Following is my select model:
>
> public class ListSelectModel extends AbstractSelectModel {
> private List<OptionModel> options;
>
> public ListSelectModel(List<String> optionList) {
>
> options = new ArrayList<OptionModel>();
> for (String s: optionList) {
> options.add(new OptionModelImpl(s, s));
> }
> }
>
> @Override
>
> public List<OptionGroupModel> getOptionGroups() {
> return null;
> }
>
> @Override
> public List<OptionModel> getOptions() {
> return options;
> }
> }
>
>
>
> Am I missing something here?
>
> Thanks....
>