Slider bar with values
-
Hello,
Amazing plugin even with free version! Thanks a lot!
Only thing I am struggling with is assigning value to a slider button. It has a min and max, say 50-100, which is percentage in my case.
I really want to use the slider button, but I cannot assign a value to the steps like I can with a dropdown.
The number is not the multiplier. So 50 percent is value 0.3, 60 percent is 0.33…. while 100 is just 0.4. It flattens. So I need to assign my specific multiplier. It could be done exponentially aswell, surely?
Any way around this?
Thanks!
The page I need help with: [log in to see the link]
-
Hello,
If you want to assign the slider’s step dynamically by programming, you should use a calculated field as auxiliary.
Please, insert a calculated field in the form (you can hide it by ticking a checkbox in its settings) with the equation:
getField(10).set_step(fieldname11);And that’s all.
Best regards.Hello,
Thank you for the reply, but this doesn’t quite do what I want.. This function replaces the steps with the value also for the user, visually.
Also I cannot hide the field I am fetching the value from (dropdown), there is no checkbox for hiding field from public page. This is my form now: https://utleiepartner.no/?cff-form=1
Look at this:
https://www.satelliteindustries.com/calculator/#The steps are 1-10 hours visually, but the value is lower when you pass 6 hours. So in example the values of each hour are:
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 6.5
8 = 7
9 = 7.5
10 = 8
11 = 8.5
12 = 9etc..
Can I achieve this using the slider?
Thanks a lot!
Actually, I am a little unsure now.
My values are as above, and now it shows 1-12 in the hours setup.
Will it use the values in the final equation instead of the visual number, i.e. 9 instead of 12?
Still though, I cannot hide the field I am fetching the value from. Any way to do this?
Thanks!
Hello @akarinotodden
If you want to hide a field, there are multiple alternatives:
* If it is a fixed value, you should use a hidden field.
* If it is a calculated field, you should tick the checkbox: “Hide field from public page” in its settings.
* For any other field, you can enter the class namehidethrough its attribute: “Add CSS Layout Keywords.”.Now the equation. If you want to transform the value entered by the user into a different value for calculation, you can use conditional statements as part of the equation associated with the calculated field. Similar to:
(function(){ switch(fieldname10){ case 7: return 6.5; case 8: return 7; case 9: return 7.5; case 10: return 8; case 11: return 8.5; case 12: return 9; default: return fieldname10; } })()Or using an object for conversion:
(function(){ var convert = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:6.5, 8:7, 9:7.5, 10:8, 11:8.5, 12:9}; return convert[fieldname10]; })()Or a simplified version of the previous equation:
({1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:6.5, 8:7, 9:7.5, 10:8, 11:8.5, 12:9})[fieldname10]Or even with mathematics:
MAX(fieldname10-6, 0)*0.5+6Best regards.
Hello again,
Thanks for incredible efforts to help me!
Now its just up to me – but I don’t understand where the functions should be added?
The MAX() math is not correct eighter – it should gradually increase from 1-6 before increasing in increments of 0.5 instead of 1 from 7-12. Now it seems to keep the number even up to 6 and then multiply after that.
Can you point me in the right direction here please. I am sure your functions work, but putting them in the calculated field I used for getField(10).set_step(fieldname11); from your first answer did nothing!
Thanks again!
Hello @akarinotodden
You are merging solutions to different questions. You should use one of them, not both.
If you want to display the integers numbers 1,2,3, …, 12 in the slider field, but manage the real values: 1, 2, 3, 4, 5, 6, 6.5, 7, 7.5, 8, 8.5, and 9 for calculation, you should use the solutions recommended previously as part of the equations associated with the calculated fields. The equations must be entered through the “Set equation” attributes in the settings of the calculated fields.
If you change the step of the slider field, as in the answer to the initial question, the equations in the last entry would not work.
Best regards.
Hello again,
I didn’t use both but I thought I could just place one of the functions into a hidden calculated field and it would convert the value of fieldname10 in my final equation(which of course is also a calculated field)
Can you give an example of where to place the function so it shows up in my final equation? I tried all three, both in its own calculated field and my final equation. Can’t make it convert the 7-12 values no matter where I place it.
Thanks again and sorry for my ignorance! I am all new to this plugin.
Hello @akarinotodden
Please, insert a calculated field in the form, and enter the following piece of code into its “Set equation” attribute:
IF(6<fieldname10,MAX(fieldname10-6,0)*0.5+6, fieldname10)And that’s all.
Best regards.Hello again.
Still does the same.
https://utleiepartner.no/?cff-form=1
This is my setup now:
fieldname10 is a slider with min 1 and max 12 and step 1
one calculated field with
IF(6<fieldname10,MAX(fieldname10-6,0)*0.5+6, fieldname10)
and one calculated field with my final equation:
PREC(
(fieldname7) * (fieldname10/5) * (fieldname9) * (fieldname11), 0)But fieldname10 returns the exact same for every step, from 1-12.
What am I missing?
Hello @akarinotodden
You are transforming the value in the calculated field with the equation:
IF(6<fieldname10,MAX(fieldname10-6,0)*0.5+6, fieldname10)Your final equation must use the previous calculated field instead of the slider field. If the name of the previous calculated field is for example: fieldname123, the equation in the final calculated field would be:
ROUND(fieldname7 * fieldname123/5 * fieldname9 * fieldname11)Best regards.
Hello again,
Of COURSE. My bad, I should’ve tried that but the other function worked the other way!
Now it is working! Thank you tons for your patience!
The topic ‘Slider bar with values’ is closed to new replies.