yohanboniface / Leaflet.FormBuilder

Utility to create forms connected to L.Class instances
7 stars 3 forks source link

the Range (if value bigger than 100, it will display 100) #6

Open xiongjiabin opened 7 years ago

xiongjiabin commented 7 years ago

Below is how I fix this problem. Move the this.fetch to the palace after set min and max.

L.FormBuilder.Input = L.FormBuilder.Element.extend({

build: function () {
    this.input = L.DomUtil.create('input', this.options.className || '', this.parentNode);
    this.input.type = this.type();
    this.input.name = this.name;
    this.input._helper = this;
    if (this.options.placeholder) {
        this.input.placeholder = this.options.placeholder;
    }
    if (this.options.min !== undefined) {
        this.input.min = this.options.min;
    }
    if (this.options.max !== undefined) {
        this.input.max = this.options.max;
    }
    if (this.options.step) {
        this.input.step = this.options.step;
    }
    **# this.fetch();**
    L.DomEvent.on(this.input, this.getSyncEvent(), this.sync, this);
    L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this);
},
xiongjiabin commented 7 years ago

Look like the default max vlaue is 100, if you set a value more than 100 before you set the max, the value will be 100. I tested in Chrome!