-
1. Re: Dynamic component hiding question
dmitry.demyankov Nov 13, 2007 3:48 AM (in response to progzmaster)Can you post your code snippet here?
I think you should try putting inputText inside panel and reRender that panel. -
2. Re: Dynamic component hiding question
progzmaster Nov 13, 2007 4:14 AM (in response to progzmaster)i declare inputText components in my jsf bean
private HtmlInputText companyInput;
private HtmlInputText personInput;
.. and initialize it
companyInput = new HtmlInputText();
companyInput.setValue( "" );
companyInput.setRendered( false );
personInput = new HtmlInputText();
personInput.setValue( "" );
personInput.setRendered( false );
.. then bind in jsf page
<h:inputText id="companyInput" binding="#{training.companyInput}" >
<h:inputText id="personInput" binding="#{training.personInput}" >
.. of course bean training is declared if faces-config
<managed-bean>
<managed-bean-class>beans.TrainingBean</managed-bean-class>
<managed-bean-name>training</managed-bean-name>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
.. and richfaces elements on selectOneMenu...
<h:selectOneMenu id="trainingType" value="#{training.trainingType}" >
<a4j:support event="onchange" reRender="companyInput,personInput" actionListener="#{training.updateView}" immediate="true" />
<f:selectItem itemValue="one" itemLabel="Option one />
<f:selectItem itemValue="two" itemLabel="Option two" />
</h:selectOneMenu>
and in updateView() i would like to do something like
getCompanyInput().setRendered( true );
so after reRendering of companyInput the component wil be visible -
3. Re: Dynamic component hiding question
progzmaster Nov 13, 2007 4:57 AM (in response to progzmaster)"dmitry.demyankov" wrote:
I think you should try putting inputText inside panel and reRender that panel.
I've tryied to do so but with no success. -
4. Re: Dynamic component hiding question
ilya_shaikovsky Nov 13, 2007 5:54 AM (in response to progzmaster)"progzmaster" wrote:
"dmitry.demyankov" wrote:
I think you should try putting inputText inside panel and reRender that panel.
I've tryied to do so but with no success.
This should work. Paste latest snippet you've used please. -
5. Re: Dynamic component hiding question
progzmaster Nov 14, 2007 5:18 AM (in response to progzmaster)"ilya_shaikovsky" wrote:
This should work. Paste latest snippet you've used please.
Ok i have figured out the problem.
When HtmlSelectOneMenu have immediate attribute set to true everything is ok because i have no validation on form components.
When I add some validation for example required="true"
everything breaks because a4j:support actionListener
is not called before process validation phase.
If I add immediate="true" to a4j:support
then actionListener is called but I don't get
valid value of selectOneMenu.
What should I do ? -
6. Re: Dynamic component hiding question
ilya_shaikovsky Nov 14, 2007 5:35 AM (in response to progzmaster)you should wrap to a4j:region the component that should be processed without another components validation. immediate is unnesessary in this case.
-
7. Re: Dynamic component hiding question
progzmaster Nov 14, 2007 5:43 AM (in response to progzmaster)"ilya_shaikovsky" wrote:
you should wrap to a4j:region the component that should be processed without another components validation. immediate is unnesessary in this case.
Thank you very much. It works !!!