Alpaca slider not working

314 views Asked by At

I am trying to run alpaca slider but I am not able to use it in my project with property slider= true any idea how can I make it work using alpaca only. Is any specific version of alpaca needed for this to work?

I am using following code:

$(function() {
    $("#field2").alpaca({
        "data": 18,
        "options": {
            "type": "integer",
            "label": "Snow Days:",
            "helper": "Number of Snow Days in January 2011",
            "slider": true
        },
        "schema": {
            "minimum": 1,
            "maximum": 31
        }
    });
});
2

There are 2 answers

15
Oussama BEN MAHMOUD On BEST ANSWER

welcome to Stackoverflow.

There are two solution for this, your code is correct but to show the slider for your component you should add jquery-ui to your page. The second solution is to add the property inputType in the options object.

/..
"options": {
  "id": "test",
  "type": "integer",
  "label": "Snow Days:",
  "helper": "Number of Snow Days in January 2011",
  "inputType": "range", 
},
/..
0
Karri Aravind On

With jquery UI version 1.12.1 and jquery version 1.12.4 "inputType": "range" in options json is working for me. This should work for you.

$(function() {
$("#field2").alpaca({
    "data": 18,
    "options": {
        "inputType": "range",
        "label": "Snow Days:",
        "helper": "Number of Snow Days in January 2011",
        "slider": true
    },
    "schema": {
        "minimum": 1,
        "maximum": 31
    }
});

});