Bootstrap Form Helpers states.js

117 Views Asked by At

I have a form to collect country and states from the user. I am using the bootstrap-formhelpers-states.js library to collect this data. But when I vardump the post array that is submitted, only the shortcodes of the states and country is sent.

My question is the same as this Bootstrap form helper not picking complete country name

but that too has not been answered. Thank you all

1

There are 1 best solutions below

1
T.Shah On

I am assuming that codes are the values given to select options. You can use jquery to change the values of each option by the text for each. Might work.

        <script>                
            $(document).ready(function() {

                $("#selectId > option").each(function() {
                    $(this).val($(this).text());
                    alert(this.text + ' ' + this.value);
                });                   

            });                
        </script>