I am trying to get the value of a spinner and display its value. Here is the spinner code:
<div id="site_content">
<div id="content">
<h:body>
<h:form>
<div class="whiteSpace" />
<p:spinner id="minutes" min="0" max="1000" value="#{printerSettings.t}" size="1">
<p:ajax update="NewTime" />
<f:validateLongRange minimum="1" maximum="1000" />
</p:spinner>
<h:message id="minutes2" for="minutes" style="color:red" />
and here is the javascript code that is called, when the user presses submit
function Thankyou() {
var minuteVal = $('minutes').val(); //not finding the minutes selected
alert(minuteVal);
alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
//location.href = 'index.xhtml';
}
I have tried
var minuteVal = $('minutes').text();
and this returns an empty box. Thanks.
Edit
The JavaScript above is found
</h:form>
</h:body>
</div>
</div>
<script type="text/javascript">
.....
</script>
</html>
at the bottom of the XHTML.
EDIT
here is the source, i don't have a clue what any of this means
In how many minutes time would you like to have your job sent to the printer ?
<div class="whiteSpace"></div>
<span id="j_idt8:minutes" class="ui-spinner ui-widget ui-corner-all">
<input id="j_idt8:minutes_input" name="j_idt8:minutes_input" type="text" class="ui-spinner-input ui-inputfield ui-state-default ui-corner-all" autocomplete="off" value="1" size="1" />
<a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only">
<span class="ui-button-text">
<span class="ui-icon ui-icon-triangle-1-n"></span>
</span>
</a>
<a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only">
<span class="ui-button-text">
<span class="ui-icon ui-icon-triangle-1-s"></span>
</span>
</a>
</span>
<script id="j_idt8:minutes_s" type="text/javascript">
PrimeFaces.cw('Spinner', 'widget_j_idt8_minutes', {
id: 'j_idt8:minutes',
step: 1.0,
min: 0.0,
max: 1000.0,
behaviors: {
change: function(event) {
PrimeFaces.ab({
source: 'j_idt8:minutes',
event: 'valueChange',
process: 'j_idt8:minutes',
update: 'j_idt8:NewTime'
}, arguments[1]);
}
}
});
</script>
<span id="j_idt8:minutes2"></span>
EDIT
function Thankyou()
{
var minutesVal = $('#minutes').spinner('value');//not finding the minutes selected
alert(minutesVal);
alert("Sent to the printing holding queue, you may close this app now or carry on using this app, your work will still print out ");
//location.href = 'index.xhtml';
}
Now nothing happens, the loading symbol on the mouse comes up but no message box etc
<p:spinner>? Presumably a templating system of some kind?