Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

Get value of slider without post

I also tried changing the slider to a simple text field. Same problem. It's not capturing the value.

So it seems like I'm experiencing a fundamental problem with capturing values of dynamically generated fields after a button click.

Do you know of any tutorials that make use of this? I feel really stuck.
Thanks!

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Get value of slider without post

Could it be that the component is refreshed (value is reset) and then you read the value?

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

Get value of slider without post

Good question. I don't think so, but let me rule that out for sure. Visually, the value never appears to reset... but let me check into this a bit and get back to you.

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

Get value of slider without post

Here's what I find interesting/confusing, taking another look at the code. Here is the generated HTML of one of my sliders:

code
<input type="number" data-type="range" class="init_slider ui-input-text ui-body-b ui-corner-all ui-shadow-inset ui-slider-input" name="init_slider_0" id="init_slider_0" min="-5" max="30">
/code
But right below that code I see the following:

code
<a href="#" class="ui-slider-handle ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" role="slider" aria-valuemin="-5" aria-valuemax="30" aria-valuenow="3" aria-valuetext="3" title="3" aria-labelledby="init_slider_label_0" style="left: 22&#46;857142857142858%;"><span class="ui-btn-inner"><span class="ui-btn-text"><&#47;span><&#47;span><&#47;a>
/code

Note the "aria-valuenow" attribute, which contains the actual value I want. I tried to capture it with jQuery, but I don't have an id. In fact, I have no idea where these "aria" attributes are coming from or where the 'a href' is being created. But I think there lies my issue...

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Get value of slider without post

https://developer.mozilla.org/en-US/d...

Try selecting the element right after the input and then finding the 'aria-valuetext' attribute.

Branden
Posts: 0
Joined: Sun Nov 03, 2013 12:10 am

Get value of slider without post

I was just thinking that. :-) Will try that and let you know how it goes. Thank you for all your patience.

Return to “Issues”