Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action("gform_pre_render", "set_chosen_options");
- function set_chosen_options($form){
- ?>
- <script type="text/javascript">
- gform.addFilter('gform_chosen_options','set_chosen_options_js');
- //limit how many options may be chosen in a multi-select to 2
- function set_chosen_options_js(options, element){
- //form id = 85, field id = 5
- if (element.attr('id') == 'input_85_5'){
- options.max_selected_options = 2;
- }
- return options;
- }
- </script>
- <?php
- //return the form object from the php hook
- return $form;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement