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