You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by rosanil <ra...@yahoo.com> on 2007/08/28 19:03:19 UTC

t:inputText help

Hi ,
I have a requirement where I need  to show a field in readonly state, very
much like how t:outPutText will show a field. There will be a small edit
icon beside that field which will make the field editable, essetially an
t:inputText will come up.

I know I can do this by going to bean and toggling from t:outPutText to
t:inputText on click of edit. But I was curious about "displayValueOnly"
attribute of t:inputText. Can this attribute really work for above purpose?
Actually it will good if I wouldnt have to go to bean for this small thing.

Any pointers will be a big help.
Thanks!
-- 
View this message in context: http://www.nabble.com/t%3AinputText-help-tf4342915.html#a12371851
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: t:inputText help

Posted by rosanil <ra...@yahoo.com>.
I'll try the options you suggested. Thanks a lot for replying!

David Delbecq-2 wrote:
> 
> use t:inputText value="..." displayValueOnly="#{not bean.inEditMode}"
> 
> You switch action can then simply change the value of bean.inEditMode to 
> true.
> It can even be made with <h:selectOneBoolean immediate="true" 
> value="#{bean.inEditMode}"/>
> 
> If you have heavy requirement for a text output with a side icon to edit 
> and don't want the trouble of having to create a boolean property bean 
> for each input text, you can create your own custom component that does 
> it. Creating custom component is not very difficult in jsf. (A bit more 
> if you use jsp view handler because you will also have to write the 
> taglib :p)
> 
> rosanil a écrit :
>> Hi ,
>> I have a requirement where I need  to show a field in readonly state,
>> very
>> much like how t:outPutText will show a field. There will be a small edit
>> icon beside that field which will make the field editable, essetially an
>> t:inputText will come up.
>>
>> I know I can do this by going to bean and toggling from t:outPutText to
>> t:inputText on click of edit. But I was curious about "displayValueOnly"
>> attribute of t:inputText. Can this attribute really work for above
>> purpose?
>> Actually it will good if I wouldnt have to go to bean for this small
>> thing.
>>
>> Any pointers will be a big help.
>> Thanks!
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AinputText-help-tf4342915.html#a12372346
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: t:inputText help

Posted by David Delbecq <de...@oma.be>.
use t:inputText value="..." displayValueOnly="#{not bean.inEditMode}"

You switch action can then simply change the value of bean.inEditMode to 
true.
It can even be made with <h:selectOneBoolean immediate="true" 
value="#{bean.inEditMode}"/>

If you have heavy requirement for a text output with a side icon to edit 
and don't want the trouble of having to create a boolean property bean 
for each input text, you can create your own custom component that does 
it. Creating custom component is not very difficult in jsf. (A bit more 
if you use jsp view handler because you will also have to write the 
taglib :p)

rosanil a écrit :
> Hi ,
> I have a requirement where I need  to show a field in readonly state, very
> much like how t:outPutText will show a field. There will be a small edit
> icon beside that field which will make the field editable, essetially an
> t:inputText will come up.
>
> I know I can do this by going to bean and toggling from t:outPutText to
> t:inputText on click of edit. But I was curious about "displayValueOnly"
> attribute of t:inputText. Can this attribute really work for above purpose?
> Actually it will good if I wouldnt have to go to bean for this small thing.
>
> Any pointers will be a big help.
> Thanks!
>