Using Fuelux spinner with form

If you want to use Fuelux spinner with <form> tag, you have to do two things:

  1. Add type="button" attribute to ‘up’ and ‘down’ buttons. Form will not send when you click the buttons.
  2. Add following script to your javascript file:

    $('.spinner').each(function(i, item) {
       var val = parseInt($(this).find('.spinner-input').val());
       $(this).spinner('value', val);
    });

    It will set values to Fuelux spinner and won’t count it from 1 but from input value.
Advertisements

One thought on “Using Fuelux spinner with form

  1. Hi, I am using the fuelx spinner in an accordian view. The spinner get initialised correctly as I can see the +/- buttons and the numbers changed when I click on the arrows. However on change event I need to add /remove rows for the next textbox. When I use the above code I get alert like ‘NAN’ which shows that the DOM is not ready

    But I still cant get it to work.. Code is as below –
    function initforcastTemplatePage() {
    initSpinners();
    handleSpinnerevt();
    }

    function initSpinners() {
    $(“.forecast-number”).ace_spinner({
    value: 1,
    min: 0,
    max: 9,
    step: 1,
    touch_spinner: true,
    on_sides: true,
    icon_up: ‘ace-icon fa fa-plus bigger-110’,
    icon_down: ‘ace-icon fa fa-minus bigger-110’,
    btn_up_class: ‘btn-success’,
    btn_down_class: ‘btn-danger’,
    change: function (event, ui) {
    $(this).change();
    //alert(ui.value);
    }
    });

    }

    function handleSpinnerevt() {
    $(‘.forecast-number’).each(function (i, item) {
    var val = parseInt($(this).find(‘.forecast-number’).val());
    alert(val);
    $(this).spinner(‘value’, val);

    });

    }

    Apprciate yiour help on this

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s