5 years ago
14
Topic

Hi

I can't set the min and max values of a SLIDER field (https://www.seblod.com/store/extensions/54677) 

in a JS code (in the SEARCH form of a SEBLOD list)  I tried


var slider = document.getElementById('myslider_field'); 

slider.noUiSlider.set([20,30]);

it updates visually the slider in the search form but no value is taken into account for the search

you have to CLICK on the slider to have the slider take the values

what is the JS code to FILL the values of the slider so that it is used in the search please ?

thanks

Cyril

Get a Book for SEBLOD
5 years ago
0
Level 1

Moreover I jave another question on this SLIDER field

If I set it in ADVANCED mode (two handles instead of one) in the content form (backend or frontend) and set both values, nothing is stored in the database when we save the content.

Does the advanced mode only work for the search form ?

Thanks

Cyril

4229 Posts
Kadministrator
5 years ago
3
Level 1

In advanced mode you need to have 2 fields, one for min and another for max.

For the first question you need to look at the documentation linked at the product page and ofcourse, you also need someone that can handle javascript.

5 years ago
2
Level 2

Hello Klas

Thanks for the 2 fields explanation, that's clearer now.

Now I can store both minand max values in the form but I have the follwing issue in the SEARCH FORM:

Now I have a JS code in the SEARCH FORM that reads the values of the slider.

BUT in the advanced mode (only) once I execute

var slider = document.getElementById('my_slider');

var values; 

values=slider.noUiSlider.get();

the slider disappears and I have a JS error in the console: Uncaught TypeError: Cannot read property 'get' of undefined


If I go back to the standard mode (one handle only) the JS script works!


Thanks


Cyril

4229 Posts
Kadministrator
5 years ago
1
Level 3

"you need to look at the documentation linked at the product page and ofcourse, you also need someone that can handle javascript."

5 years ago
0
Level 4

Yes we did

But when the field is set to advanced mode AND both min (field) and max(field) are filled with their matching fields the method ( slider.noUiSlider.get() ) that is DESCRIBED IN THE DOCUMENTATION (at https://refreshless.com/nouislider/slider-read-write/) doesn't work anymore, sorry !

thanks

cyril

5 years ago
1
Level 1

Hello

Can someone test and confirm the issue please ?

thanks

cyril

4229 Posts
Kadministrator
5 years ago
0
Level 2

There is no issue, you are hacking the code, there is no support for that.

5 years ago
5
Level 1

Hi Klas

Why do you say we are hacking the code ?? I don't understand 

We only use a seblod JS code along with a SLIDER field (in enhanced mode as described). But as we wrote if we just use the code that is describred in the documentation :

var slider = document.getElementById('my_slider');

var values;

values=slider.noUiSlider.get();

the slider disappears and I have a JS error in the console: Uncaught TypeError: Cannot read property 'get' of undefined

There is no hack at all here

Thanks for your feedback

cyril

4229 Posts
Kadministrator
5 years ago
4
Level 2

Javascript is also part of the plugin.

5 years ago
3
Level 3

Klas

how does it answer my question please ?

do you imply that I should contact the author of the original plugin ?

thanks

cyril

4229 Posts
Kadministrator
5 years ago
2
Level 4

If you add you own javascript your are effectively changing plugin code and there is no free support for that - ofcourse there is also services link that you can use.

5 years ago
1
Level 5

Using a SEBLOD js code on SEBLOD fields is the base of SEBLOD

I can't agree with you here

in the seblod plugin page you explicitely refer to the documentation where it is written how to access the slider

cyril

4229 Posts
Kadministrator
5 years ago
0
Level 6

Freedom to add your own code doesn't entitle you to the support for your experiments. This is my last reply on this topic.

5 years ago
0
Level 1

Ok, then  may be someone can answer this simple question : 

How do you retrieve the min and max values of the slider field (enhanced mode) with a JS code field ?

Please don't answer to read the documentation since the documentation claims to use slider.noUiSlider.get() which breaks the slider :) 

thanks

Cyril

Get a Book for SEBLOD