You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by THIEN PHAM <ph...@yahoo.com> on 2005/10/24 21:17:46 UTC

Lost ValueChangeListener?

I run into a problem where my HTML checkbox seems to
lose its ValueChangeListener the second time around.
Here is what I have on my JSF page:

<f:view>
  <h:form id="myform">
    <h:selectBooleanCheckbox id="myCheckBox" 
      value="#{testForm.checkBoxValue}"
     
valueChangeListener="{testForm.onCheckBoxClicked}"
     
onclick="javascript:document.forms['myform'].submit();"/>
	
  </h:form>
</f:view>

I have a backing bean TestForm that looks like this:

public class TestForm {
	
	private boolean checkBoxValue;
	
	public TestForm() {
	}

	public void onCheckBoxClicked(ValueChangeEvent evt) {
		System.out.println("Checkbox is clicked");
	}
	
	public boolean isCheckBoxValue() {
		return checkBoxValue;
	}
	public void setCheckBoxValue(boolean checkBoxValue) {
		this.checkBoxValue = checkBoxValue;
	}
}

When the page first came up, I clicked on the checkbox
I could see the message "Checkbox is clicked". But if
I clicked again, the same ValueChangeListener did not
get invoked. Does anybody know what I did wrong? TIA
for your help. BTW, I am using MyFaces 1.1.0.


		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs