You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Nazmul Bhuiyan <Na...@nz.fujitsu.com> on 2007/08/14 02:14:51 UTC

T3: PropertySelecton

Hello,

I want the user to choose Code and Description. But I can only let the user
choose Code or the Description by the PropertySelection.
Is there any component similar to PropertySelection that I can use for this
purpose, so that user can see Code and Description?
Some code example would be great help for me.

Regards

Naz


My current code looks like:

.html
<tr>
  <td width="1%" nowrap>Address Type: </td>
  <td width="99%">
    <select jwcid="addrType">
      <option value="0">Postal</option>
      <option value="1">Street</option>
    </select>
  </td>
</tr>

.page
<property-specification name="addrType" type="java.lang.String" />

<component id="addrType" type="PropertySelection">
	<binding name="model" expression="availAddrType"></binding>
	<binding name="value" expression="AddrType"></binding>
</component>

.java
public abstract String getAddrType();
public abstract void setAddrType(String addrType);

public IPropertySelectionModel getAvailAddrType() {
String[] addrTypeArray = 
EfiAddrTypeDAO.getActiveEfiAddrTypeDescrList().toArray(new String[0]);
	return new StringPropertySelectionModel(addrTypeArray);
}

-- 
View this message in context: http://www.nabble.com/T3%3A-PropertySelecton-tf4264534.html#a12136626
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


RE: T3: PropertySelecton

Posted by Ma...@bmw.ch.
To customize the label for your selects, you'll have to implement you
own IPropertySelection or inherit from existing one and override
getLabel(int).

As for disabling/hiding stuff dynamically: you can set submitOnChange to
true (see
http://tapestry.apache.org/tapestry3/doc/ComponentReference/PropertySele
ction.html). Perhaps, put the PropertySelection in its own form if you
don't want everything to be submitted when the selection changes.

> -----Original Message-----
> From: Nazmul Bhuiyan [mailto:Nazmul.Bhuiyan@nz.fujitsu.com] 
> Sent: Tuesday, August 14, 2007 5:44 AM
> To: users@tapestry.apache.org
> Subject: Re: T3: PropertySelecton
> 
> 
> Not really, I'm retrieving data from the database that has 
> code and description. If I display code in the 
> PropertySelection then that doesn't make any sense to user. I 
> would like to display the description beside the code.
>  
> I also need to enable and disable some of the fields 
> according to the item selected form the PropertySelection.
> 
> Even better if I can render only specific fields to enter 
> specific data if user selects one thing in PropertySelection 
> and other fields to enter other data if user selects other.
> 
> For example if user selects org=Y then user should only see 
> the organization specific fields in the form and if user 
> selects org=N then user should only see the person specific 
> fields in the form to enter data.
> 
> Is there any T3 specific code example that I can see to 
> understand how "onchange" works?
> 
> Thanks a lot
> 
> 
> Jessek wrote:
> > 
> > Do you mean having two <select> lists where the second list 
> depends on 
> > what is selected in the first?
> > 
> > I use this ~all~ the time in combination with 
> @EventListener to update 
> > the second list when something changes via "onchange" in the first.
> > 
> > On 8/13/07, Nazmul Bhuiyan <Na...@nz.fujitsu.com> wrote:
> >>
> >> Hello,
> >>
> >> I want the user to choose Code and Description. But I can only let 
> >> the user choose Code or the Description by the PropertySelection.
> >> Is there any component similar to PropertySelection that I can use 
> >> for this purpose, so that user can see Code and Description?
> >> Some code example would be great help for me.
> >>
> >> Regards
> >>
> >> Naz
> >>
> >>
> >> My current code looks like:
> >>
> >> .html
> >> <tr>
> >>   <td width="1%" nowrap>Address Type: </td>
> >>   <td width="99%">
> >>     <select jwcid="addrType">
> >>       <option value="0">Postal</option>
> >>       <option value="1">Street</option>
> >>     </select>
> >>   </td>
> >> </tr>
> >>
> >> .page
> >> <property-specification name="addrType" type="java.lang.String" />
> >>
> >> <component id="addrType" type="PropertySelection">
> >>         <binding name="model" expression="availAddrType"></binding>
> >>         <binding name="value" expression="AddrType"></binding> 
> >> </component>
> >>
> >> .java
> >> public abstract String getAddrType(); public abstract void 
> >> setAddrType(String addrType);
> >>
> >> public IPropertySelectionModel getAvailAddrType() { String[] 
> >> addrTypeArray = 
> >> EfiAddrTypeDAO.getActiveEfiAddrTypeDescrList().toArray(new 
> String[0]);
> >>         return new StringPropertySelectionModel(addrTypeArray);
> >> }
> >>
> >> --
> >> View this message in context:
> >> 
> http://www.nabble.com/T3%3A-PropertySelecton-tf4264534.html#a12136626
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> > 
> > 
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> > 
> > Open source based consulting work centered around 
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/T3%3A-PropertySelecton-tf4264534.html#a12138311
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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: T3: PropertySelecton

Posted by Nazmul Bhuiyan <Na...@nz.fujitsu.com>.
Not really, I’m retrieving data from the database that has code and
description. If I display code in the PropertySelection then that doesn’t
make any sense to user. I would like to display the description beside the
code.
 
I also need to enable and disable some of the fields according to the item
selected form the PropertySelection.

Even better if I can render only specific fields to enter specific data if
user selects one thing in PropertySelection and other fields to enter other
data if user selects other.

For example if user selects org=Y then user should only see the organization
specific fields in the form and if user selects org=N then user should only
see the person specific fields in the form to enter data.

Is there any T3 specific code example that I can see to understand how
"onchange" works?

Thanks a lot


Jessek wrote:
> 
> Do you mean having two <select> lists where the second list depends on
> what is selected in the first?
> 
> I use this ~all~ the time in combination with @EventListener to update
> the second list when something changes via "onchange" in the first.
> 
> On 8/13/07, Nazmul Bhuiyan <Na...@nz.fujitsu.com> wrote:
>>
>> Hello,
>>
>> I want the user to choose Code and Description. But I can only let the
>> user
>> choose Code or the Description by the PropertySelection.
>> Is there any component similar to PropertySelection that I can use for
>> this
>> purpose, so that user can see Code and Description?
>> Some code example would be great help for me.
>>
>> Regards
>>
>> Naz
>>
>>
>> My current code looks like:
>>
>> .html
>> <tr>
>>   <td width="1%" nowrap>Address Type: </td>
>>   <td width="99%">
>>     <select jwcid="addrType">
>>       <option value="0">Postal</option>
>>       <option value="1">Street</option>
>>     </select>
>>   </td>
>> </tr>
>>
>> .page
>> <property-specification name="addrType" type="java.lang.String" />
>>
>> <component id="addrType" type="PropertySelection">
>>         <binding name="model" expression="availAddrType"></binding>
>>         <binding name="value" expression="AddrType"></binding>
>> </component>
>>
>> .java
>> public abstract String getAddrType();
>> public abstract void setAddrType(String addrType);
>>
>> public IPropertySelectionModel getAvailAddrType() {
>> String[] addrTypeArray =
>> EfiAddrTypeDAO.getActiveEfiAddrTypeDescrList().toArray(new String[0]);
>>         return new StringPropertySelectionModel(addrTypeArray);
>> }
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T3%3A-PropertySelecton-tf4264534.html#a12136626
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> -- 
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
> 
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T3%3A-PropertySelecton-tf4264534.html#a12138311
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T3: PropertySelecton

Posted by Jesse Kuhnert <jk...@gmail.com>.
Do you mean having two <select> lists where the second list depends on
what is selected in the first?

I use this ~all~ the time in combination with @EventListener to update
the second list when something changes via "onchange" in the first.

On 8/13/07, Nazmul Bhuiyan <Na...@nz.fujitsu.com> wrote:
>
> Hello,
>
> I want the user to choose Code and Description. But I can only let the user
> choose Code or the Description by the PropertySelection.
> Is there any component similar to PropertySelection that I can use for this
> purpose, so that user can see Code and Description?
> Some code example would be great help for me.
>
> Regards
>
> Naz
>
>
> My current code looks like:
>
> .html
> <tr>
>   <td width="1%" nowrap>Address Type: </td>
>   <td width="99%">
>     <select jwcid="addrType">
>       <option value="0">Postal</option>
>       <option value="1">Street</option>
>     </select>
>   </td>
> </tr>
>
> .page
> <property-specification name="addrType" type="java.lang.String" />
>
> <component id="addrType" type="PropertySelection">
>         <binding name="model" expression="availAddrType"></binding>
>         <binding name="value" expression="AddrType"></binding>
> </component>
>
> .java
> public abstract String getAddrType();
> public abstract void setAddrType(String addrType);
>
> public IPropertySelectionModel getAvailAddrType() {
> String[] addrTypeArray =
> EfiAddrTypeDAO.getActiveEfiAddrTypeDescrList().toArray(new String[0]);
>         return new StringPropertySelectionModel(addrTypeArray);
> }
>
> --
> View this message in context: http://www.nabble.com/T3%3A-PropertySelecton-tf4264534.html#a12136626
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

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