Dual List Box Widget : Set a default for options

  • nickbh
    Asked on November 8, 2016 at 8:17 AM

    Hi,

     

    I am using the "Dual Listbox Widget".  The widget works fine.  However I have a few of questions?

     

    1) Can you default the list to have some suggestions pre-selected?

    2) Is it possible to assign pre-selected "picks" through updating the source code

     

    If it is not possible - can you suggest an alternative widget or field type that would allow the editing of the source code to pre-populate the "picks".

     

    Any info greatly appreciated

     

  • John_Benson
    Replied on November 8, 2016 at 10:55 AM

    1) Can you default the list to have some suggestions pre-selected?

    To my understanding, you want to have a default options pre-selected in the Dual List widget. Unfortunately, there is no option to set a default values in that widget. By default, all options will be on the first column/box.

    2) Is it possible to assign pre-selected "picks" through updating the source code

    You may download the form source code and have a developer check if that is possible. Here's a guide on How-to-get-the-Full-Source-Code-of-your-Form.

    If it is not possible - can you suggest an alternative widget or field type that would allow the editing of the source code to pre-populate the "picks".

    Sorry but there are no similar widgets related to this. However, you can use the "Update/Calculate Field Condition" in order to update a specific fields based on the selected option. The only problem is you need to manually add the fields and the the conditions.

    Here's a guide: https://www.jotform.com/help/286-How-to-Pass-Field-Value-to-Another-Field

    Let us know if you have any questions. Thank you.

  • nickbh
    Replied on November 14, 2016 at 9:33 PM

    Hi John,

     

    I'm still investigating this.  I have reviewed the source code and can see the correct section - but not sure if its possible to set any options - ie of what by default should be selected.

     

    So I started to look at workarounds.  But again unless I am mistaken there is no way to update a dual list box with selections by passing a value from another field?  If it is possible can you send me a demo form?

     

    Thanks

    PS I found the codeby using the developer tools online in Google chrome - but don't have a clue where to find the code (ie which file)?  If I knew I think could easily achieve what I need.

    <select multiple="multiple" id="bootstrap-duallistbox-selected-list_duallistbox[]" class="form-control" name="duallistbox[]_helper2" style="height: 220px;"><option value="Arinsal">Arinsal</option><option value="Canillo">Canillo</option><option value="La Massana">La Massana</option></select>

     

  • Kevin Support Team Lead
    Replied on November 14, 2016 at 11:08 PM

    Unfortunately the condition to copy the value from a field to another will only work if you copy the field from the widget to a different field, but if you want to copy the value from a field to the widget then it will not work, this is because the way how  widgets are developed and this is also why you cannot find the widget in the source code, because widgets are loaded in a different way compared to normal fields such as text boxes, email field or address fields. 

    So will not be possible at the moment to pre-define some options in the widget even getting the source code.

    What we can do is to request this feature to our developers if you want, we will forward then this thread to our second level, but we cannot ensure an ETA or if this will be available; however, will would let you know as soon as we get news regarding this. 

    Please do let us know if you would like this to be escalated so we can proceed. 

     

  • nickbh
    Replied on November 15, 2016 at 5:01 AM

    Yes please.  If you could escalate it to the development team that would be great.  It is a very useful widget that allows handling of multiple (and large quantities) of data simply.  However without the control to pre-populate or update it makes working with it cumbersome to the user.

     

    E.g if you have a list of carefully selected options of say 60 out of a 100, and then you use a form to update the data, obviously the end users has to remember to again include the 60 previously selected options even if they only wish to add a further 1?

     

    Many Thanks

     

  • Helen
    Replied on November 15, 2016 at 6:00 AM

    Thanks for contacting us.

    I have escalated this thread to our second level as a feature request so this could be evaluated by our developers. 

    Please do note that we cannot provide an ETA about when this could be available or if this will be implemented, but we will ensure to let you know as soon as we receive news regarding this request. 

  • nickbh
    Replied on January 25, 2017 at 5:09 PM

    Any update on this?  It would appear that none of the listboxes elements/widgets in Jotform are capable of prepopulation?

    I'm sure many would find it useful to populate with multiple selections?

     

  • John_Benson
    Replied on January 25, 2017 at 5:32 PM

    Sorry for the inconvenience. The issue is still being investigated by our developers. So far, we don't have any updates yet. We will notify you via this thread once there is an update.

    Thank you for your patience.

  • nickbh
    Replied on January 26, 2017 at 10:02 AM

    OK - So I have been doing plenty of investigation in the source code to see if I can get a workaround.  >

     

    1) I have recreated the jotform using a standard dropdown box with a multiple select.  

    2) Now I can manually edit the source code and change the selections as their is no widget involved

    3) I have identified the IDs of the Select boxes I want to change 

    4) My intention is to add a little JavaScript to update the fields based on the POST Data I have received

    The java script I am trying to use is very simple>

    <body>

      <select id='multipleSelect' multiple='multiple'>

      <option value="1">1</option>

      <option value="2">2</option>

      <option value="3">3</option>

    </select>

     

    <script type="text/javascript">

    $("#multipleSelect").val(["1","2","5"]);

    </script>

     

    However I am struggling to get the script to wok on my form.  My test (ie above) works fine - but when I introduce the the snippet shown below it has no affect on the form?>

     

    Dual List Box Widget : Set a default for options Image 1 Screenshot 20

     

     

    If you could point me in the right direction it would be very helpful?

    Thanks

     

  • Kiran Support Team Lead
    Replied on January 26, 2017 at 11:42 AM

    I understand that you want to have some options to be selected in the dropdown box and have them listed on the textbox field. Is that correct?

    Could you check the if the function provided in the Solution#3 works for you from the link below?

    https://www.codeproject.com/Questions/751244/How-to-set-a-Textbox-Value-on-selection-of-a-dropd

     

    You may the options selected by default by using selected attribute in the select element.

    Let us know how it goes. We will be happy to help. 

  • nickbh
    Replied on January 26, 2017 at 12:27 PM

    No- sorry that's not what I am trying to achieve.  The text box is just there for my Testing.  

    What I need to be able to do is dynamically change the values of the dropdown.  There is some history on this issue and indeed another thread.

    https://www.jotform.com/answers/990773-Form-Prepopulation-Can-we-select-multiple-drop-down-items-using-URL-query-string#3

    My solution above is to create a workaround so that the data I pass to the form can prepopulate a dropdown.  So far their is no widget or dropdown field that can be populated through query string.  Hence my need to update the source code.

    Hope you can help - its driving me crazy.... Thanks

  • Kevin Support Team Lead
    Replied on January 26, 2017 at 1:41 PM

    I have checked this on my end and I can see it does now work either, the code you provided and the code I found does not work. 

    Currently I'm testing the one from this link: http://jsfiddle.net/5czG4/ 

    And testing this one too: http://jsfiddle.net/jackwanders/kGgkE/ 

    They work fine, but when trying to implement the code in the source code of the form it does not work. 

    So far we would need to wait for an answer from our second level and will also ask for help to my colleagues to find a workaround. 

    Please, also let us know if the samples provided work as you want, prop-populating options in a drop down with custom data. 

     

  • nickbh
    Replied on January 26, 2017 at 2:04 PM

    Ok - If second level could have a look thanks.  Yes those methods I am sure would be very helpful.  Thanks

     

  • John_Benson
    Replied on January 26, 2017 at 2:17 PM

    This thread is already assigned to one of our developer. I will ask the developer assigned to this thread if there are any updates regarding this feature request. We'll let you know once an information is available. Thank you.

  • nickbh
    Replied on October 26, 2017 at 7:14 PM

    I am just reviewing the form that I had to use the source code from and create a workaround and it occurred to me that there may have been some updates?

    So my question remains:

    Is any of the following yet possible?

    A)The pre-population of multiple selected options in a drop-down list?

    B)The passing of multiple options to either the

                 1) Visual Multi Select Widget or

                 2) Dual List Box?

    As mentioned previously this would be very beneficial as every time I change my form I have to re-embed a great deal of additional source code.


    Thanks

    Nick



  • Kevin Support Team Lead
    Replied on October 26, 2017 at 8:55 PM

    A) I'm not sure if this is possible, I have tested some methods to try to pre-populate multiple options in a basic drop down field and I cannot get it working, I will consult with my colleagues if there is a method to achieve that. 

    B) It's still not possible, the feature request that was raised  from this thread is still opened, we will keep you updated via this thread.