-
1. Re: jquery
damnre Jun 9, 2008 10:36 AM (in response to damnre)Soory the code didn't show up..
<script type="text/javascript"> alert('zzz') $(document).ready(function() { alert('yyy') $("#selDesAllCheckBox").click(function() { alert('xxx') var checked_status = this.checked; $("input[@name=paradigm]").each(function() { this.checked = checked_status; }); }); }); </script> <h:selectBooleanCheckbox id="selDesAllCheckBox"/> <input type="checkbox" name="paradigm" value="Imperative"/> <input type="checkbox" name="paradigm" value="Object-Oriented"/>
-
2. Re: jquery
sergeysmirnov Jun 9, 2008 12:06 PM (in response to damnre)RichFaces is shipped with JQuery. Do you use it or add your own copy to the project?
-
3. Re: jquery
damnre Jun 9, 2008 12:27 PM (in response to damnre)I use the standard one that comes with richfaces...
i just want to do the function with rich:query...
and didn't have any success at all!
i also tried to do it by loading<a4j:loadScript src="resource:///org/richfaces/renderkit/html/scripts/jquery/jquery.js"/>
but still didn't work any idea what i'm doing wrong? -
4. Re: jquery
sergeysmirnov Jun 9, 2008 12:53 PM (in response to damnre)First of all, you have to use jQuery() instead of $(). It is mentioned right in the second paragraph of jQuery demo: http://livedemo.exadel.com/richfaces-demo/richfaces/jQuery.jsf
Also, do not forget that JSF adds prefix to the each id of the form element. So, even you have jQuery("#selDesAllCheckBox"), it might not be working because the id of the checkbox might not be a "selDesAllCheckBox", but something like "myform:selDesAllCheckBox". So, the selector should be jQuery("#myform:\\selDesAllCheckBox")
P.S. Why not using rich:jQuery in your concrete case? It will some both problem you have implicitly. -
5. Re: jquery
damnre Jun 9, 2008 1:02 PM (in response to damnre)thanks for the reply Sergey...
yes i try to use rich:jquery but im unable to reproduce the function with rich:jquery<script type="text/javascript"> alert('zzz') $(document).ready(function() { alert('yyy') $("#selDesAllCheckBox").click(function() { alert('xxx') var checked_status = this.checked; $("input[@name=paradigm]").each(function() { this.checked = checked_status; }); }); }); </script> <h:selectBooleanCheckbox id="selDesAllCheckBox"/> <input type="checkbox" name="paradigm" value="Imperative"/> <input type="checkbox" name="paradigm" value="Object-Oriented"/>
-
6. Re: jquery
damnre Jun 9, 2008 1:22 PM (in response to damnre)oki got it finally
<rich:jQuery timing="onload" selector="#selDesAllCheckBox" query="click( function(){ var checked_status = this.checked; jQuery('input[@name=paradigm]').each(function(){this.checked = checked_status;}); } );"/>