You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Allen Guo <el...@gmail.com> on 2007/07/26 13:02:46 UTC

Select component problem in T5

Hi All,

When I use select
  <select disabled="false" t:id="currency_id" t:type="select" 
model="currencyModel" value="currency" size="1"/>
I always get the generate html code like this 
  <select disabled="disabled" id="currency_id" name="currency_id" size="1">
         <option disabled="disabled" value="$">$<option 
disabled="disabled" value="CAD_$">CAD_$
         <option disabled="disabled" selected="selected" value="RMB">RMB
         <option disabled="disabled" value="GB">GB</select><img 
alt="[Error]" class="t-error-icon t-invisible" id="currency_id:icon" 
src="/bogo/assets/tapestry/field-error-marker.png">

You see, every <option tag include a property disabled="disabled" . So I 
can't change the select  in FireFox, but I can in IE.

I remember I have ever asked the propblem before. Someone tell me that 
this may is my fault . I'm told I may don't use disable="false" in <select
In fact, I exactlly use disabled="false". But the problem still occurred.

Can anybody give me some sugesstion?

Allen Guo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Select component problem in T5

Posted by Allen Guo <el...@gmail.com>.
Sorry, it should be getCurrencyModel().
But the code is similar to getCountryCode()

Allen Guo 写道:
> Hi Nick,
>
> Below is definitely code I call the method to get the model .
> .........
> public SelectModel getCountryModel() {
> List<OptionModel> options = new ArrayList<OptionModel>();
> List list = service.getBaseCountryDao().findAll(); // fetch the list 
> from database
> if (list == null){
> return null;
> }
> Iterator iter = list.iterator();
> while (iter.hasNext()) {
> Country obj = (Country) iter.next();
> OptionModel option = new OptionModelImpl(obj.getName(), true, obj
> .getCode());
> options.add(option);
> }
> return new SelectModelImpl(null, options);
> }
> ..........
>
>
> Nick Westgate 写道:
>> The problem is not the disabled="false".
>> Last time I asked you to post your model code, but you didn't
>>
>> I'm pretty sure the problem is in your model.
>>
>> Cheers,
>> Nick.
>>
>>
>> Allen Guo wrote:
>>> Hi All,
>>>
>>> When I use select
>>> <select disabled="false" t:id="currency_id" t:type="select" 
>>> model="currencyModel" value="currency" size="1"/>
>>> I always get the generate html code like this <select 
>>> disabled="disabled" id="currency_id" name="currency_id" size="1">
>>> <option disabled="disabled" value="$">$<option disabled="disabled" 
>>> value="CAD_$">CAD_$
>>> <option disabled="disabled" selected="selected" value="RMB">RMB
>>> <option disabled="disabled" value="GB">GB</select><img alt="[Error]" 
>>> class="t-error-icon t-invisible" id="currency_id:icon" 
>>> src="/bogo/assets/tapestry/field-error-marker.png">
>>>
>>> You see, every <option tag include a property disabled="disabled" . 
>>> So I can't change the select in FireFox, but I can in IE.
>>>
>>> I remember I have ever asked the propblem before. Someone tell me 
>>> that this may is my fault . I'm told I may don't use disable="false" 
>>> in <select
>>> In fact, I exactlly use disabled="false". But the problem still 
>>> occurred.
>>>
>>> Can anybody give me some sugesstion?
>>>
>>> Allen Guo
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Select component problem in T5

Posted by Allen Guo <el...@gmail.com>.
Thanks Nick again.

Nick Westgate 写道:
> Because individual options can be disabled.
>
> Also, you shouldn't really use OptionModelImpl because it is
> an internal class and may change in the future.
>
> (1) You can pass a map (names to codes) and Tapestry will create
> the model for you.
>
> (2) More work, implement the SelectModel interface. Daniel Jue
> posted an interesting generic solution here:
> http://www.phy6.net/wiki/tiki-index.php?page=Tapestry+5+GenericSelectionModel 
>
>
> Cheers,
> Nick.
>
>
> Allen Guo wrote:
>> I changed
>> OptionModel option = new OptionModelImpl(obj.getName(), true, 
>> obj.getCode());
>> to
>> OptionModel option = new OptionModelImpl(obj.getName(), false, 
>> obj.getCode());
>>
>> It works fine. But I don't know why OptionModelImpl construction need 
>> the second parameter.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Select component problem in T5

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Because individual options can be disabled.

Also, you shouldn't really use OptionModelImpl because it is
an internal class and may change in the future.

(1) You can pass a map (names to codes) and Tapestry will create
the model for you.

(2) More work, implement the SelectModel interface. Daniel Jue
posted an interesting generic solution here:
http://www.phy6.net/wiki/tiki-index.php?page=Tapestry+5+GenericSelectionModel

Cheers,
Nick.


Allen Guo wrote:
> I changed
> OptionModel option = new OptionModelImpl(obj.getName(), true, 
> obj.getCode());
> to
> OptionModel option = new OptionModelImpl(obj.getName(), false, 
> obj.getCode());
> 
> It works fine. But I don't know why OptionModelImpl construction need 
> the second parameter.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Select component problem in T5

Posted by Allen Guo <el...@gmail.com>.
I changed
OptionModel option = new OptionModelImpl(obj.getName(), true, 
obj.getCode());
to
OptionModel option = new OptionModelImpl(obj.getName(), false, 
obj.getCode());

It works fine. But I don't know why OptionModelImpl construction need 
the second parameter.



Allen Guo 写道:
> Hi Nick,
>
> Below is definitely code I call the method to get the model .
> .........
> public SelectModel getCountryModel() {
> List<OptionModel> options = new ArrayList<OptionModel>();
> List list = service.getBaseCountryDao().findAll(); // fetch the list 
> from database
> if (list == null){
> return null;
> }
> Iterator iter = list.iterator();
> while (iter.hasNext()) {
> Country obj = (Country) iter.next();
> OptionModel option = new OptionModelImpl(obj.getName(), true, obj
> .getCode());
> options.add(option);
> }
> return new SelectModelImpl(null, options);
> }
> ..........
>
>
> Nick Westgate 写道:
>> The problem is not the disabled="false".
>> Last time I asked you to post your model code, but you didn't
>>
>> I'm pretty sure the problem is in your model.
>>
>> Cheers,
>> Nick.
>>
>>
>> Allen Guo wrote:
>>> Hi All,
>>>
>>> When I use select
>>> <select disabled="false" t:id="currency_id" t:type="select" 
>>> model="currencyModel" value="currency" size="1"/>
>>> I always get the generate html code like this <select 
>>> disabled="disabled" id="currency_id" name="currency_id" size="1">
>>> <option disabled="disabled" value="$">$<option disabled="disabled" 
>>> value="CAD_$">CAD_$
>>> <option disabled="disabled" selected="selected" value="RMB">RMB
>>> <option disabled="disabled" value="GB">GB</select><img alt="[Error]" 
>>> class="t-error-icon t-invisible" id="currency_id:icon" 
>>> src="/bogo/assets/tapestry/field-error-marker.png">
>>>
>>> You see, every <option tag include a property disabled="disabled" . 
>>> So I can't change the select in FireFox, but I can in IE.
>>>
>>> I remember I have ever asked the propblem before. Someone tell me 
>>> that this may is my fault . I'm told I may don't use disable="false" 
>>> in <select
>>> In fact, I exactlly use disabled="false". But the problem still 
>>> occurred.
>>>
>>> Can anybody give me some sugesstion?
>>>
>>> Allen Guo
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Select component problem in T5

Posted by Allen Guo <el...@gmail.com>.
Hi Nick,

Below is definitely code I call the method to get the model .
.........
public SelectModel getCountryModel() {
List<OptionModel> options = new ArrayList<OptionModel>();
List list = service.getBaseCountryDao().findAll(); // fetch the list 
from database
if (list == null){
return null;
}
Iterator iter = list.iterator();
while (iter.hasNext()) {
Country obj = (Country) iter.next();
OptionModel option = new OptionModelImpl(obj.getName(), true, obj
.getCode());
options.add(option);
}
return new SelectModelImpl(null, options);
}
..........


Nick Westgate 写道:
> The problem is not the disabled="false".
> Last time I asked you to post your model code, but you didn't
>
> I'm pretty sure the problem is in your model.
>
> Cheers,
> Nick.
>
>
> Allen Guo wrote:
>> Hi All,
>>
>> When I use select
>> <select disabled="false" t:id="currency_id" t:type="select" 
>> model="currencyModel" value="currency" size="1"/>
>> I always get the generate html code like this <select 
>> disabled="disabled" id="currency_id" name="currency_id" size="1">
>> <option disabled="disabled" value="$">$<option disabled="disabled" 
>> value="CAD_$">CAD_$
>> <option disabled="disabled" selected="selected" value="RMB">RMB
>> <option disabled="disabled" value="GB">GB</select><img alt="[Error]" 
>> class="t-error-icon t-invisible" id="currency_id:icon" 
>> src="/bogo/assets/tapestry/field-error-marker.png">
>>
>> You see, every <option tag include a property disabled="disabled" . 
>> So I can't change the select in FireFox, but I can in IE.
>>
>> I remember I have ever asked the propblem before. Someone tell me 
>> that this may is my fault . I'm told I may don't use disable="false" 
>> in <select
>> In fact, I exactlly use disabled="false". But the problem still 
>> occurred.
>>
>> Can anybody give me some sugesstion?
>>
>> Allen Guo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Select component problem in T5

Posted by Nick Westgate <ni...@key-planning.co.jp>.
The problem is not the disabled="false".
Last time I asked you to post your model code, but you didn't

I'm pretty sure the problem is in your model.

Cheers,
Nick.


Allen Guo wrote:
> Hi All,
> 
> When I use select
>  <select disabled="false" t:id="currency_id" t:type="select" 
> model="currencyModel" value="currency" size="1"/>
> I always get the generate html code like this  <select 
> disabled="disabled" id="currency_id" name="currency_id" size="1">
>         <option disabled="disabled" value="$">$<option 
> disabled="disabled" value="CAD_$">CAD_$
>         <option disabled="disabled" selected="selected" value="RMB">RMB
>         <option disabled="disabled" value="GB">GB</select><img 
> alt="[Error]" class="t-error-icon t-invisible" id="currency_id:icon" 
> src="/bogo/assets/tapestry/field-error-marker.png">
> 
> You see, every <option tag include a property disabled="disabled" . So I 
> can't change the select  in FireFox, but I can in IE.
> 
> I remember I have ever asked the propblem before. Someone tell me that 
> this may is my fault . I'm told I may don't use disable="false" in <select
> In fact, I exactlly use disabled="false". But the problem still occurred.
> 
> Can anybody give me some sugesstion?
> 
> Allen Guo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org