[TikiWiki-commits] [Git][tikiwiki/tiki][24.x] [BP][FIX] tracker(list page): Add client-side validation for batch item deletion

"Baraka Kinywa \(@bkinywa24\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68a5affe20537_2cd6d9447b7@gitlab-sidekiq-low-urgency-cpu-bound-v2-78d9d68c78-85d6h.mail>

Baraka Kinywa pushed to branch 24.x at Tiki Wiki CMS Groupware / Tiki


Commits:
bd512b93 by MAGENE Sem Joel at 2025-08-20T14:16:40+03:00
[BP][FIX] tracker(list page): Add client-side validation for batch item deletion
---
* [BP][FIX] tracker(list page): Add client-side validation for batch item deletion
---
* [BP][FIX] tracker(list page): Add client-side validation for batch item deletion
---
* [BP][FIX] tracker(list page): Add client-side validation for batch item deletion
---
* [FIX] tracker(list page): Add client-side validation for batch item deletion
---
* [FIX] tracker(list page): Add client-side validation for batch item deletion

See merge request tikiwiki/tiki!8016

See merge request tikiwiki/tiki!8220

See merge request tikiwiki/tiki!8222

See merge request tikiwiki/tiki!8228

(cherry picked from commit e7560cb35444e40b1a06f067db2d407301df463c)

See merge request tikiwiki/tiki!8231

- - - - -


1 changed file:

- templates/tiki-view_tracker.tpl


Changes:

=====================================
templates/tiki-view_tracker.tpl
=====================================
@@ -336,7 +336,7 @@
                     {if $tiki_p_admin_trackers eq 'y'}
                         <div class="form-group row">
                             <div class="input-group min-width-customized">
-                                <select name="batchaction" class="form-control">
+                                <select name="batchaction" class="form-control trackerbatchaction">
                                     <option value="no_action" selected="selected">
                                         {tr}Select the action to be performed with checked{/tr}...
                                     </option>
@@ -350,7 +350,7 @@
                                 <span class="input-group-append">
                                     {ticket}
                                     <input type="hidden" name="trackerId" value="{$trackerId}">
-                                    <input type="submit" class="btn btn-primary" name="act" value="{tr}OK{/tr}">
+                                    <input type="submit" class="btn btn-primary js-confirm-delete" name="act" value="{tr}OK{/tr}">
                                 </span>
                             </div>
                         </div>
@@ -561,3 +561,25 @@
         {/tab}
     {/if}
 {/tabset}
+
+{jq}
+    const selectItemMsg = '{tr}Please select at least one item.{/tr}';
+    // Target the batch delete button to add validation.
+    $('.js-confirm-delete').on('click', function(event) {
+        const form = $(this).closest('form');
+        const batchAction = form.find('select.trackerbatchaction').val();
+
+        // For any other action, the form submits normally without interference.
+        if (batchAction === 'delete') {
+            
+            const itemsSelected = form.find('input[name="action[]"]:checked').length;
+            
+            if (itemsSelected == 0) {
+                // Stop the default form submission.
+                event.preventDefault();
+                // Validation failed: show an feedback and do nothing else.
+                feedback(selectItemMsg,'warning');
+            }
+        }
+    });
+{/jq}



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

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