Guest User

Untitled

a guest
Dec 13th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. $(function() {
  2. //store select options values to map the options.
  3. var data = window.formyoula.form_fields["719d-648d-5b11"].get("attributes").select_option_values.split("\n");
  4. //Formyoula form select element component id to get child select list values to map with options.
  5. $("#component-719d-648d-5b11 select > option").each( function( index, element ) {
  6. //If check for skiping the "--None--" at index 0.
  7. if ( index > 0 ) element.value = data[index-1];
  8. });
  9. });
  10. //On change select options function.
  11. $('select').change(function() {
  12. //Get the options value form formyoula select list element.
  13. var options = window.formyoula.form_fields["719d-648d-5b11"].get("select_options").split("\n");
  14. //Get Select List values.
  15. var options_val = window.formyoula.form_fields["719d-648d-5b11"].get("attributes").select_option_values.split("\n");
  16. //Set the custom data to hidden field
  17. var data = options[options_val.indexOf($( this ).val())] + $( this ).val();
  18. //Set Select List option as value of hidden field.
  19. window.formyoula.form_fields['Hidden Field'].set( { value: data } );
  20. });
Add Comment
Please, Sign In to add comment