• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

edit able

 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys does anybody now about this,,
how to disable h:inputText when it populated with value from database??
and h:inputText which have no value in there it still enable...




please reply asap if you know the answer
thanks guys
gbu
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can disable input on an h:inputText control by specifying the "disabled="true"" attribute on the inputText element. If you want more flexibility, you can make this an EL expression, instead.

If you're a real glutton for punishment, you can even access the control's underlying INPUT text control and set its "disabled" attribute, but that's a little trickier.
 
leonardo ginting
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:You can disable input on an h:inputText control by specifying the "disabled="true"" attribute on the inputText element. If you want more flexibility, you can make this an EL expression, instead.

If you're a real glutton for punishment, you can even access the control's underlying INPUT text control and set its "disabled" attribute, but that's a little trickier.




hi tim thanks for repy by the way i have another problem
and this is litle bit deviate from the topic here is my issues this is about h:selectOneMenu with valueCHangeListener
so
i had two comboBox lets call



1. FRUIT

-- apel

-- manggoes



2. PRICE

-- expensive

-- middle

-- low



and for your information below this comboBox i have a TABLE,,



where i chose the FRUIT "apel" and PRICE "middle" it would be reRendering the TABLE,

and value in TABLE change according to the value in the ComboBox changed..



and the problem is i can see in the log When Fruit is Change but when price is changed it do nothing

i meant when i chose "middle",, in the log there is no change at all..


can tell me how to solve this,,
if you need to see my code i'll provide it...
thanks before tim
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, we'd prefer that when you change questions, you start a new topic, It makes it easier for other people with the same problem to search and find answers, plus it avoids the confusion where different people are answering different questions at the same time.

A ValueChangeListener only fires when the actual value changes. So if I pull down the price list, but end up with the same price entry as I started with, no value change event is fired.

As I mentioned earlier, it takes a Submit to get the client talking to the server. So to make the listener fire, you'd either have to have the user click a command button or link or you'd have to use AJAX. With RichFaces, the AJAX approach is easy. Just add an "a4j:support" element as a child of the selectOneMenu. Use the "ajaxSingle="true"" attribute to avoid problems where other controls would interfere with the valuechange.

It's a good idea to keep the actual valueChange event handler simple. What I normally do looks like this:


That resets the child menu and allows proper setup of the new child's selection options based on the newly-selected parent option and keeps the overhead to a minimum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic