[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [BP][FIX][UX] Trackers (import/export): prevent reset of the form fields when...

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <688c89c04c5b6_2cd5f5c30175@gitlab-sidekiq-low-urgency-cpu-bound-v2-78ddbdb4c5-zx2wf.mail>

ushindi bienvenu pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki


Commits:
9833834c by Alain Cisirika at 2025-08-01T09:26:56+00:00
[BP][FIX][UX] Trackers (import/export): prevent reset of the form fields when a feedback error appears
---
* [FIX][UX] Trackers (import/export): prevent reset of the form fields when a feedback error appears
---
* [FIX] prevent not reset the form fields when the feedback error appears

See merge request tikiwiki/tiki!8008

See merge request tikiwiki/tiki!8102

- - - - -


2 changed files:

- lib/core/Services/Tracker/TabularController.php
- templates/tabular/create.tpl


Changes:

=====================================
lib/core/Services/Tracker/TabularController.php
=====================================
@@ -66,13 +66,17 @@ class Services_Tracker_TabularController
     {
         Services_Exception_Denied::checkGlobal('tiki_p_tabular_admin');
 
+        $format = [];
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-            if (empty($input->trackerId->int())) {
-                Feedback::error(tr('No Tracker Selected.'));
+            $format["name"] = $input->name->text();
+            $format["prefill"] = $input->prefill->text();
+            if (empty($input->trackerId->int()) || empty($input->name->text())) {
+                Feedback::error(tr('Both Tracker ID and Name are required.'));
             } else {
                 $lib = TikiLib::lib('tabular');
 
-                $tabularId = $lib->create($input->name->text(), $input->trackerId->int(), $input->use_odbc->int() ? $input->odbc->none() : []);
+                $format["trackerId"] = $input->trackerId->int();
+                $tabularId = $lib->create($format["name"], $format["trackerId"], $input->use_odbc->int() ? $input->odbc->none() : []);
 
                 $forward = [
                     'controller' => 'tabular',
@@ -94,6 +98,7 @@ class Services_Tracker_TabularController
 
         return [
             'title' => tr('Create Import-Export Format'),
+            'format' => $format,
             'has_odbc' => function_exists('odbc_connect'),
         ];
     }


=====================================
templates/tabular/create.tpl
=====================================
@@ -17,7 +17,7 @@
         <div class="mb-3 row">
             <label class="col-form-label col-sm-3" for="name">{tr}Name{/tr}</label>
             <div class="col-sm-9">
-                <input class="form-control" type="text" name="name" id="name" required>
+                <input class="form-control" type="text" name="name" id="name" value="{$format.name|escape}" required>
             </div>
         </div>
         <div class="mb-3 row">
@@ -30,7 +30,7 @@
             <label class="form-check-label col-sm-3" for="prefill">{tr}Initialize this format with the current tracker fields{/tr}</label>
             <div class="col-sm-9">
                 <div class="form-check">
-                    <input class="form-check-input" type="checkbox" name="prefill" id="prefill">
+                    <input class="form-check-input" type="checkbox" name="prefill" id="prefill" {if !empty($format.prefill)}checked{/if}>
                 </div>
             </div>
         </div>



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/9833834c6e4bb8b5f80e4ed72e0e4f269d041723
You're receiving this email because of your account on gitlab.com.

_______________________________________________
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.