Skip to content

Capture select_or_add_multiple output dynamically #586

Answered by rubenarslan
courtiol asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a working version as far as I understood what you need.
https://docs.google.com/spreadsheets/d/1jKrzbxpCTq6UD2D3FtR4tHhNMTbE-G-IS3qZOQRpqN0/edit?gid=0#gid=0
The dropdown select or add multiple is backed by select2 and the value is stored in a hidden input type text. If you use jQuery, which is enabled in formr, it is easier; there's some synergy there.

$(document).ready(function () {
    $('input[name="input"]').on('input', function () {
        var textread = $(this).val();
        var match = textread.match(/\s\d+/);
        var numberread = match ? match[0] : '';
        $('#result').text(numberread);
    });

    // For Select2, use the 'change' event
    $('input[name="input2"]')

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@courtiol
Comment options

Answer selected by courtiol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants