Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

On combo selection, components visibility need to change

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 24847
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 24847
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 24847
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 24847
174
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic