CalcBuilder Forum

How to creat a Java sliders function

User moon_1218 2013-09-01 17:11:25

Im trying to make a calculator like

http://www.speakingofcode.com/demos/developer/price_estimator/index.htm


if there a sample already made so i can see the basic code for the sliders and take example.

I think many can use suck a function.

Moonsoft support 2013-09-02 14:00:15

Hello,
you can use basic sliders from jquery. Create fields as option lists with all your values, insert them at the layout, and use the javascript tab to build sliders based on each option list. For ex: an option list named 'myoptions', with 5 options, will require the following code at js tab:

var select = CB( "#myoptions" );
var slider = CB( "" ).insertAfter( select ).slider({
min: 1,
max: 5,
range: "min",
value: select.selectedIndex + 1,
slide: function( event, ui ) {
select.selectedIndex = ui.value - 1;
}
});
//Hide the original input option if needed
CB( "#myoptions" ).hide();

You'd need to change the name of the field, and the range of numeric values accepted.


Here the full official information page:

http://jqueryui.com/slider/#hotelrooms


All widgets here can be included, replacing the $ sign for the calcbuilder jquery instance 'CB'

Hope this helps, regards

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!