The boolean checkbox is set according to the value binding.
In your case is this the expression value="#{node.checked}", but you
don`t influence the checked variable in your code.
You only need to get the new value out of the event:
event.getNewValue()
and set the checked variable to it.
cheers,
Gerald
On 8/10/06, Johnny Gonzalez <[EMAIL PROTECTED]> wrote:
Hello Gerald,
Sorry for taking to long to answer,...
the part of the JSP I have is this:
<t:tree2 id="serverTree" value="#{EntradasBean.modeloArbol}" var="node"
varNodeToggler="t" clientSideToggle="true">
<f:facet name="opcion">
<h:panelGroup>
<h:selectBooleanCheckbox
title="#{node.description}" value="#{node.checked}"
valueChangeListener="#{EntradasBean.checkBoxSelected}"
onchange="this.form.submit()" immediate="true"/>
<h:outputText value="#{node.description}"
style="FONT: xx-small Verdana, Arial, Helvetica, sans-serif;"
styleClass="nodeFolder"/>
</h:panelGroup>
</f:facet>
<f:facet name="menu">
<h:panelGroup>
<h:selectBooleanCheckbox
title="#{node.description}" value="true"
valueChangeListener="#{EntradasBean.checkBoxSelected}"
onchange="this.form.submit()" immediate="true"/>
<h:outputText value="*"
rendered="#{t.nodeSelected}" />
<h:outputText value="#{node.description}"
styleClass="nodeFolder" style="FONT: xx-small Verdana, Arial, Helvetica,
sans-serif;" />
</h:panelGroup>
</f:facet>
<f:facet name="raiz">
<h:panelGroup>
<h:selectBooleanCheckbox
title="#{node.description}" value="true"
valueChangeListener="#{EntradasBean.checkBoxSelected}"
onchange="this.form.submit()" immediate="true"/>
<h:outputText value="#{node.description}"
styleClass="nodeFolder" style="FONT: xx-small Verdana, Arial, Helvetica,
sans-serif;" />
</h:panelGroup>
</f:facet>
</t:tree2>
and in the backing bean I have:
this is the valueChangeEvent method:
public void checkBoxSelected(ValueChangeEvent event){
FacesContext contexto = FacesContext.getCurrentInstance();
// Obtengo la sesion en que estamos
HttpSession sesion = ( HttpSession )
contexto.getExternalContext().getSession( false );
// Objeto para manejar el radio button
HtmlSelectBooleanCheckbox select = ( HtmlSelectBooleanCheckbox )
event.getComponent();
String valor = new String();
if(select.getValue().equals(true)){
valor = ( String ) select.getTitle();
System.out.println("ValueChange: "+valor);
this.checkBoxSelected.add(valor);
}
select.setValue(new Boolean(true));
for(String s: this.checkBoxSelected){
System.out.println(this.checkBoxSelected.size());
System.out.println(s);
}
}
What do you think about it?
thanks a lot,
Johnny
Gerald Müllan <[EMAIL PROTECTED]> escribió:
Hi,
have you set the value attribute of the h:selectBooleanCheckbox component?
What do you do in the backend method?
Would be helpful if you could support with some code fragments.
cheers,
Gerald
On 8/9/06, Johnny Gonzalez wrote:
> Hello everybody,
>
> I have built a tree with selectBooleanCheckbox, I wrote a valuechange
event
> to store if every of the h:selectBooleanCheckbox, were selected, but after
> the method is executed the page is repainted and the
h:selectBooleanCheckbox
> that I selected appears unchecked, why this strange behaviour?
>
> TIA,
>
> Johnny
>
>
> ________________________________
>
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por minuto.
> http://es.voice.yahoo.com
>
>
--
Gerald Müllan
Schelleingasse 2/11
1040 Vienna, Austria
0043 699 11772506
[EMAIL PROTECTED]
________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
--
Gerald Müllan
Schelleingasse 2/11
1040 Vienna, Austria
0043 699 11772506
[EMAIL PROTECTED]