-
1. Using jquery with richfaces 4
feuyeux Apr 29, 2011 2:12 AM (in response to aagenielsen)Don't use <h:outputscript src="jquery.js"/>, since richfaces has include it. You can check it from framework.pack.js.jsf
My machine's is: /iview/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf
And, if you defined jQuery.noConflict(), please make clear that jQuery has give up using $
-
2. Using jquery with richfaces 4
aagenielsen Apr 29, 2011 3:50 AM (in response to feuyeux)hi,
well we use Richfaces 4 and something has changed since 3.3.3. We know is pretty basic (to use jquery) but isn't simple selection jQuery('#mybean') supposed to work ? And yes we know the formid is prefixed ;-) Does anybody have a really simple example ?
best regards
aage
-
3. Using jquery with richfaces 4
feuyeux Apr 29, 2011 4:28 AM (in response to aagenielsen)Hi Aage,
Firstly, what I said is the machanism of shipping js files into richfaces, not only richfaces3.3.3 use it, but also 4.0.final
Second, your assumption is right, the component id is form_id:component_id. Additionally, you can use jQuery's all ability in richfaces project, the both framework can work together well.
The simple you can get from jQuery offical site and run it in your xhtml file, that would run well
The only thing you need to take care is do not use $ -- replace it by jQuery.
And, you need to know richfaces4.0 includes jQuery1.5.x, and richfaces3.3.3 includes jQuery1.3.2.
So, please doesn't include the jQuery.js file explicitly, and if you include the version of jQuery is not the same one of richfaces use, it will encounter conflict.
Wish you can master it soon.
BR,
Lu H.
-
4. Using jquery with richfaces 4
nbelaevski Apr 29, 2011 9:11 AM (in response to aagenielsen)I suggest to try this:
jQuery(#{rich:element('inputId')}).
-
5. Using jquery with richfaces 4
feuyeux Apr 29, 2011 12:16 PM (in response to nbelaevski)Yes! It's convenient to use jQuery(#{rich:element('inputId')}) to select the component. In this way, the selection just uses the component's id (no prefix).
-
6. Using jquery with richfaces 4
aagenielsen May 2, 2011 6:55 AM (in response to feuyeux)That fixed it - our example ended with:
<h:form id="qwerty">
<h:outputText value="Field to copy:" />
<h:inputText id="a1" value="#{simple.name}"/>
<h:inputText id="a2" />
<script>function copy(e){
jQuery(#{rich:element('a2')}).val(jQuery(#{rich:element('a1')}).val());
}</script>
<rich:jQuery query="copy(event)" event="keyup" selector="#a1"/>
</h:form>
Thanks !
aage