Michael, Thanks that worked perfectly, however for some strange reason, I
still need the value encoder. Without it, I get the following error.

You must correct the following errors before continuing.

   - Selected option is not listed in the model.

It works perfectly fine with the encoder, I'm assuming it's not converting
the client string back to a boolean. Any thoughts?



On Thu, Sep 19, 2013 at 10:00 AM, Michael Gagauz <gagau...@gmail.com> wrote:

> You can't do it using SelectModelFactory  unless you'll create some kind
> of wrapper for Boolean. Try to create SelectModel manually:
>
>         List<OptionModel> tardies = new ArrayList<OptionModel>();
>         tardies.add(new OptionModelImpl("Y", true));
>         tardies.add(new OptionModelImpl("N", false));
>
>         new SelectModelImpl(null, tardies);
>
> P.S. You don't need encoder for boolean.
>
> 19.09.2013 17:40, George Christman пишет:
>
>  I'm using a standard select menu nested within a loop. The boolean values
>> come from my hibernate entity. I took a look at the enumSelectModel, I'm
>> just not sure how to get it to work with my entity.
>>
>> .tml
>>
>>        <t:Loop source="fields" value="field" encoder="encoder">
>>          <div class="col-xs-15">
>>              <div>
>>                  <t:Select value="field.propertyValue"
>> clientId="${field.**propertyName}" model="selectModel"
>> blankOption="literal:never" encoder="encoderSelect"/>
>>              </div>
>>          </div>
>>      </t:Loop>
>>
>> .java
>>
>>      @Property
>>      private FieldEntity field;
>>
>>      @Prroperty
>>      private List<FieldEntity>  fields;
>>
>>      @Inject
>>      private SelectModelFactory selectModelFactory
>>
>>      public SelectModel getSelectModel() {
>>          List<Boolean>  tardies = new ArrayList<Boolean>();
>>          tardies.add(true);
>>          tardies.add(false);
>>          return this.selectModelFactory.**create(tardies);
>>      }
>>
>>      public ValueEncoder getEncoderSelect() {
>>          return new ValueEncoder<Boolean>() {
>>              public String toClient(Boolean value) {
>>                  return value.toString();
>>              }
>>              public Boolean toValue(String clientValue) {
>>                  return "true".equals(clientValue) ? true : false;
>>              }
>>          };
>>      }
>>
>>
>> FieldEntity.class
>>
>>      @NonVisual
>>      private boolean tsTardy01;
>>      @NonVisual
>>      private boolean tsTardy02;
>>      @NonVisual
>>      private boolean tsTardy03;
>>      @NonVisual
>>      private boolean tsTardy04;
>>
>>
>> On Thu, Sep 19, 2013 at 9:03 AM, Eugen<eugens...@gmail.com>  wrote:
>>
>>  Hi,
>>> which select model are You using?
>>> if You use an EnumSelectModel the client side caption is build as follow:
>>> Enum.class.getSimpleName()+"."**+Enum.name()
>>>
>>>
>>> 2013/9/19 George 
>>> Christman<gchristman@cardaddy.**com<gchrist...@cardaddy.com>
>>> >:
>>>
>>>> Hello, I'm wondering if anybody knows how to rename the options in a
>>>>
>>> select
>>>
>>>> menu using .properties or some other method. I currently have true false
>>>>
>>> in
>>>
>>>> the menu and that needs to be changed to Y N.
>>>>
>>>> Thanks,
>>>> George
>>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Reply via email to