Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- //store select options values to map the options.
- var data = window.formyoula.form_fields["719d-648d-5b11"].get("attributes").select_option_values.split("\n");
- //Formyoula form select element component id to get child select list values to map with options.
- $("#component-719d-648d-5b11 select > option").each( function( index, element ) {
- //If check for skiping the "--None--" at index 0.
- if ( index > 0 ) element.value = data[index-1];
- });
- });
- //On change select options function.
- $('select').change(function() {
- //Get the options value form formyoula select list element.
- var options = window.formyoula.form_fields["719d-648d-5b11"].get("select_options").split("\n");
- //Get Select List values.
- var options_val = window.formyoula.form_fields["719d-648d-5b11"].get("attributes").select_option_values.split("\n");
- //Set the custom data to hidden field
- var data = options[options_val.indexOf($( this ).val())] + $( this ).val();
- //Set Select List option as value of hidden field.
- window.formyoula.form_fields['Hidden Field'].set( { value: data } );
- });
Add Comment
Please, Sign In to add comment