Guest User

Untitled

a guest
Dec 16th, 2017
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. //Below example is used when admin don't want to expose the emails on Entry List view.
  2. //To run below JS we need one formyoula select list element and one hidden filed element.
  3. //Use a Formyoula JavaScript element to run the below JS example.
  4. //Listen to Select List changes
  5. $('select').change(function() {
  6. //Get the options value form formyoula select list element.
  7. var options = window.formyoula.form_fields["abcd-abcd-abcd"].get("select_options").split("\n");
  8. //Set the emails as a Select list optional value. ex: For Options on Select list: Customer Support, Sales Support.
  9. var emails = ["customer@gmail.com","sales@gmail.com"];
  10. //Get the index of changed option.
  11. var index = options.indexOf($( this ).val());
  12. //Set Select List option as value of hidden field.
  13. window.formyoula.form_fields['Hidden Field'].set( { value: emails[index] } );
  14. });
Add Comment
Please, Sign In to add comment