Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

On combo selection, components visibility need to change  RSS feed

 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I have one combobox --> with values 1, 2, 3
2) If i am selecting 1, one textfield need to be shown
3) If i am selecting 2, one calendar need to be shown
4) If i am selecting 3, 2 textfields need to be shown

How it can be achived using JSF/Richfaces package
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same way as core JSF. Just put a "rendered=" EL expression on each of the visibility-controlled controls. Something like 'rendered="#{myBean.comboValue == 1}".

What RichFaces can add is AJAX support so you don't have to re-render the entire page. Add an a4j:support sub-element to the combobox, make it "ajaxSingle="true"" to limit what data is submitted to be ONLY the combobox. Set the "reRender" attribute to name the controls whose visibility needs updating.
 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

I had made a test page for doing the same, but failed. I had tried what you explained as

and also with the following code

The isOneId() method of bean is not calling.( i had made a log inside that method).
Whether im doing anything wrong. Please quote me if anything wrong with me


 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is isOneId() declared like so?


Usually when a method isn't being invoked, there's a problem with its signature that keeps JSF from finding the method.
 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Is isOneId() declared like so?


Usually when a method isn't being invoked, there's a problem with its signature that keeps JSF from finding the method.


Hi Tim,

Exactly same.

 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about


If the action couldn't fire, that might have interefered with the process.
 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
I deleted every thing and started again. Now the method is calling but component is not viewing. I made the action as void ie


One interesting thing i found is after changing the combo, if i am pressing the F5 button then the component is viewing. So i put everything inside a panel group and rerendered that group id too. Now its coming


 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on whether you're running JSF1 or JSF2, an action processor returning void may not be called because the JSF1 signature demands something that takes nothing and returns a string.

If you re-render a group (container), you don't need to indicate members of that container. Everything in the container will re-render.
 
Babu Raj K R
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Tim

Thank you very much,

yes we need to rerender only the container.....

Now i will come back to you for help in making composite components ie;
i need a time field which contain 3 combobox one with hours with 00-24 and another with minutes with 00-59 and another same with 00-59 for seconds.
first let me will make a try
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!