We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Get values from input range

Home Forums Puzzles Get values from input range

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10426
    brownie
    Participant

    Hi,

    This is my first post as I’m currently working on a configurator for architecture.
    I want to allow the user to set the floor plan dimensions with a slider system.
    I have grabbed this snippet to make this slider that actually works while being very simple.

    <Script language=’javascript’>
    function updateTextInput(val) {
    document.getElementById(‘textInput’).value=val;
    }
    </script>

    <input type=”range” name=”rangeInput” min=”0″ max=”100″ onchange=”updateTextInput(this.value);”>
    <input type=”text” id=”textInput” value=””>

    But I can’t get values from this input back in my puzzle module. I’ve tried several possibilities with no success.
    Could you tell how I can proceed, or maybe it’s impossible ?

    Thanks a lot

    #10434

    Hi!

    A possible reason why this does not work can be that rangeInput is the name and not the id of the element (the Puzzles only work with ids).

    If it doesn’t help, feel free to attach a sample project here so that we can take a look.

    Chief 3D Verger | LinkedIn | Twitter

    #10437
    brownie
    Participant

    Many thanks,

    I’ve tried (hopefully with no minor syntax mistakes) with textInput, rangeInput, nothing works. Here’s my test project.

    #10440

    Got it – you have to convert your scale factor to number first as value is textual:

    BTW print to console is a very useful puzzle with which you can check if events are fired, and what values are generated in the script.

    Attachments:
    You must be logged in to view attached files.

    Chief 3D Verger | LinkedIn | Twitter

    #10444
    brownie
    Participant

    Great !

    I could have found this by myself.

    Many thanks !! :)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.