Hi ,
I am trying to change the value of an input depending on selection from a combo box, so is user selects "Yes" from combo box the input should contain "test" value and than if user selects "No" the input should be empty , "test" value remove from it.
I tryed to do it runing the following code:
<h:inputText id="myInput" value="aaa" styleClass="myInputStyleClass" />
<h:selectOneMenu id="myComboBox" value="#{bean.boolVal}">
<f:selectItem itemLabel="#{m.n}" itemValue="false" />
<f:selectItem itemLabel="#{m.y}" itemValue="true" />
</h:selectOneMenu>
<rich:jQuery timing="onload" selector="#myComboBox" query="change(
function(){
if ($(this).val() == true) {
$('.myInputStyleClass').val('test');
}
} )" />
Running it in this version the javascript error "Object doesn't support this property or method" still occurs.(when i change selection in combo box)
After removing
if ($(this).val() == true)
condtion and additionals { } the first javascript error is gone but another is raised saying "null is 'null' or not an object", when i change selection in combo box.
I am not sure if only rich faces jars (3.3.2) had support for this jQuery implementatios like using "$" and other methods (may be some jQuery libraries are nedded), this could be one reason why this is not working in my opinion.
Please, any idea about how to implement this behavior are welcomed.
Regards, Radu