[TikiWiki-commits] [Git][tikiwiki/tiki][30.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 <6a96768833caf_3819573016971@gitlab-sidekiq-low-urgency-cpu-bound-v2-7987d65cf8-tqzv6.mail>

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


Commits:
a5d807c1 by Victor Emanouilov at 2026-09-01T09:53:54+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
=====================================
@@ -1019,6 +1019,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,
@@ -1033,6 +1039,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/a5d807c10cfdd989bd57668db6457eca07990167

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/a5d807c10cfdd989bd57668db6457eca07990167
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.