[TikiWiki-commits] [Git][tikiwiki/tiki][27.x] [FIX] customsearch default value selection for UserSelector fields

"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a9676937e783_3818e660842fe@gitlab-sidekiq-low-urgency-cpu-bound-v2-7987d65cf8-mvm6c.mail>

Victor Emanouilov pushed to branch 27.x at Tiki Wiki CMS Groupware / Tiki


Commits:
ce5cf668 by Victor Emanouilov at 2026-09-01T09:54:05+03:00
[FIX] customsearch default value selection for UserSelector fields

- - - - -


1 changed file:

- lib/wiki-plugins/wikiplugin_customsearch.php


Changes:

=====================================
lib/wiki-plugins/wikiplugin_customsearch.php
=====================================
@@ -1034,6 +1034,12 @@ function cs_design_select($id, $fieldname, $fieldid, $arguments, $default, &$scr
                 }
             }
         } elseif ($field['type'] === 'u') { // User Selector (only when in dropdown list mode)
+            if ($default) {
+                $field['value'] = is_array($default)
+                    ? implode(',', array_filter($default, 'strlen'))
+                    : $default;
+                $handler = TikiLib::lib('trk')->get_field_handler($field);
+            }
             $html = $handler->renderInput([
                 'id' => $arguments['id'] ?? '',
                 'filter_render' => true,
@@ -1048,6 +1054,11 @@ $('#$fieldid').on('change', function() {
     });
 });
 ";
+            if ($default) {
+                $script .= "
+$('#$fieldid').trigger('change');
+";
+            }
             return $html;
         } elseif (in_array($field['type'], ['d','D','R','M'])) { // or types - dropdown, dropdown with other, radio button. multiselect
             $data = $handler->getFieldData();



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ce5cf66847084a9cefed35a1c61463e751a1d5c3

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ce5cf66847084a9cefed35a1c61463e751a1d5c3
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.