PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

drop down value

  1. I have been looking through the forums and haven't been able to find exactly what I am looking for...but I believe it is possible with some jquery and a little know-how (of which i dont have any right now). I am trying to get the info from a selected drop down to changed the data in the form, while the user is still on the form. I can do some of this with conditional logic, but the list I have is very large and subject to change which would mean a lot of conditions that would need to then be adjusted....basically: Get the selected drop down and have that choice display somewhere else on the form while the user is still filling the form out.

    Ideally:
    I have a drop down menu which is populated from a taxonomy. I would like to access the "Label" when the menu item is selected, I would also like to be able to access the "Value" of the selected menu item--by access these I mean insert them into the form at different spots.

    Scenario:
    50 Items.
    Each item will have 1-4 as a value.
    your filter = {drop_down_label:57}
    Each item name (label) will correspond to an image.
    /img_{drop_down_label:1}.png

    I found a couple of other posts that did similar things to this (at least to grabbing the label) but they weren't quite accomplishing the same thing.

    Posted 9 years ago on Wednesday June 13, 2012 | Permalink
  2. Still working on this issue, I have tried this function--thinking that bind('change', function() would monitor the dropdown and populate the field. still no good. Any thoughts anyone?

    add_filter("gform_pre_render_4", "monitor_dropdown");
    function monitor_dropdown($form){
    
    ?>
        <script type="text/javascript">
        jQuery(document).ready(function(){
    
            jQuery('#input_40').bind('change', function()
            {
                //get selected value from drop down;
                var selectedValue = jQuery("#input_40").val();
    
                //populate a text field with the selected drop down value
                jQuery("#input_61").val(selectedValue);
            });
        });
        </script>
    <?php
    
    return $form;
    }
    Posted 9 years ago on Thursday June 14, 2012 | Permalink
  3. ok. I am making progress on this. my error was that I specified the form _4 but then did not specify the form on the input

    add_filter("gform_pre_render_4", "monitor_dropdown");
    function monitor_dropdown($form){
    
    ?>
        <script type="text/javascript">
        jQuery(document).ready(function(){
    
            jQuery('#input_4_40').bind('change', function()
            {
                //get selected value from drop down;
                var selectedValue = jQuery("#input_4_40").val();
    
                //populate a text field with the selected drop down value
                jQuery("#input_4_61").val(selectedValue);
            });
        });
        </script>
    <?php
    
    return $form;
    }
    Posted 9 years ago on Thursday June 14, 2012 | Permalink