-
1. Re: Check value of rich:inputNumberSpinner with JavaScript
michpetrov Jul 17, 2013 8:32 AM (in response to ronny2013)RichFaces use jQuery so you can advantage of that:
checkValue = function() { if (RichFaces.$('fForm:spinner').getValue() == #{bean.maxValue}) { $('#fForm\\:radios\\:0').attr('checked','checked'); } else { $('#fForm\\:radios\\:1').attr('checked','checked'); } return false; };
this will work providing the maxValue doesn't change, if it does you'll have to rerender this code.
-
2. Re: Check value of rich:inputNumberSpinner with JavaScript
ronny2013 Aug 5, 2013 4:09 AM (in response to michpetrov)Hi,
thanks for your help.
I'm realy a noob with JQuery. Can you give me a tip how I have to add your code to my jsf page and bind it to the rich:inputNumberSpinner?
Should I use the rich:JQuery tag or the Script tag to define the function?
-
3. Re: Check value of rich:inputNumberSpinner with JavaScript
michpetrov Aug 6, 2013 4:40 AM (in response to ronny2013)The script tag will do, just replace your function with mine. The <rich:jQuery> is not for outputting Javascript.
-
4. Re: Check value of rich:inputNumberSpinner with JavaScript
ronny2013 Aug 6, 2013 7:43 AM (in response to michpetrov)Ok, I tried it a second time and added a onchange="jQuery(checkValue);" to the event in the spinner. Now it works fine.
Thank you.
-
5. Re: Check value of rich:inputNumberSpinner with JavaScript
michpetrov Aug 6, 2013 8:34 AM (in response to ronny2013)Ronny Schöne wrote:
Ok, I tried it a second time and added a onchange="jQuery(checkValue);" to the event in the spinner. Now it works fine.
Thank you.
I am surprised this works (you are certainly not supposed to do it this way). Why didn't onchange="checkValue()" work?
-
6. Re: Check value of rich:inputNumberSpinner with JavaScript
ronny2013 Aug 6, 2013 8:44 AM (in response to michpetrov)hmm, now this also works. Maybe I forgot to refresh the page earlier?