Board Logo

understanding VAR structure in Tigra Slider Control
murray - 12/11/2007 at 09:58 AM

I have been working with the multi-demo slider, changing the ranges, the type of slider tool, background images,etc.

I understand enough of what I need to set up to now move to the stage of trying to do something with the numbers resulting from moving the sliders.

There are a few things confusing me (so far).

The first I like, but don't understand. I can move a slider or enter a number from the keyboard in the field associated with the slider, and the demo appears to 'keep' the typed- in entries if I click on the screen outside the text box. However, if I type in a number and the Enter key, everything resets to the default/start values. This seems like a 4th unintended (?) entry mode. (Type & click outside the box, drag slider tool/widget, return to blow away entries & reset them, and SUBMIT button).

Since I can make entries on-screen by typing (and clicking outside the box) or dragging a slider, and can see the results, can I simply access the new values and do calculations with them WITHOUT post or submit? All I want to do is have a user move sliders to desired numbers and write JS formulas to calculate results (ideally live on-screen) as the sliders are being moved, so the user can 'fine-tune' for desired result. Ideally, the result should appear on the same page as the slider screen. Is this possible, or is a SUBMIT/POST/GET action mandatory?

I am trying to incorporate my JavaScript equations, but am not familiar with the slightly more complex structure of the VAR's used in Tigra Slider/. They appear to be arrays or some other type of grouping of elements. I say this because I see the same VARs or 'sub-var's' in each of the slider setups in the multi-slider demo.

I have been fumbling around trying to access the VAR's with document.write, alert, etc. One I got a desired result, the 'live' updating of results on the same page as the inputs, but have no idea how I did it.

Other times, my 'output' starts a new page, and the original input disappears and I see a single number on-screen. NOT the desired outcome. I am trying to understand how to display a result without generating a new screen of results.

Back to the 'array-like' VAR the heck to I 'call' one of the sub-variables in the multi-slider demo, like for example

<script language="JavaScript">
var A_TPL1h = {
'b_vertical' : false,
'b_watch': true,
'n_controlWidth': 640,
'n_controlHeight': 16,
'n_sliderWidth': 16,
'n_sliderHeight': 15,
'n_pathLeft' : 1,
'n_pathTop' : 1,
'n_pathLength' : 640,
's_imgControl': 'img/sldr5h_bg.gif',
's_imgSlider': 'img/blueh_sl.gif',
'n_zIndex': 1

var A_INIT1h = {
's_form' : 0,
's_name': 'sliderValue1h',
'n_minValue' : 1,
'n_maxValue' : 1000,
'n_value' : 150,
'n_step' : 0.5
new slider(A_INIT1h, A_TPL1h);

alert (A_INIT1h[n_value])

Sheesh, I can all the math for what I want but the grammar/context is killing me.

If this is too unfocused, I can post my working slider page and link to it.

Thank you


murray - 12/11/2007 at 09:59 AM

If I could edit my posts, I'd fix the gibberish sentences for clarity.

tigra - 12/11/2007 at 09:05 PM

that's a lot of questions...
1) whatever slider does it does not require any form submissions, everything happens on the client side
2) changes in form inputs don't affect the slider directly. in our samples input boxes are assigned event handlers (onchange) that call slider's methods to sync the values. If it doesn't work the way you expect you're free to use other event handlers for that (onkeypress etc.)

alert (A_INIT1h['n_value'])

note quotes around string n_value, alternative would be:


it's general javascript thing, not slider specific

murray - 12/30/2007 at 08:47 PM

Thank you.

Back to forum: