how to reset/clear form fields after Modal closed - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: how to reset/clear form fields after Modal closed (/showthread.php?tid=82479) |
how to reset/clear form fields after Modal closed - Ahmed Haroon - 07-15-2022 was following a tutorial (https://mfikri.com/en/blog/crud-codeigniter4-modal) it was contained 2 separate codes for Add & Edit but I want to use 1 single code for both Add & Edit. so, rename EditModal to dmlModal and used same for Add too, is this approach is right or i have to change? please if have a link for same, help post here. created a view file which have Single Modal for both Add & Edit actions, but when click on Edit in the list view and close (edited or not) and press Add button, the Modal shows previously selected data. how i can refresh / reset / clear that form completely after closing no matter use made changes or not ( user pressed Close or Save button or pressing x on right top corner... in all cases ), please help. note: i am exploring CI and not yet touched JS regards in Controller method ' update ' : PHP Code: public function update() view file below: PHP Code: <!DOCTYPE html> tried code below ( from stackoverflow ) in my view file but didn't worked PHP Code: <script> . RE: how to reset/clear form fields after Modal closed - includebeer - 07-15-2022 This has nothing to do with CodeIgniter. It's a jQuery / javascript question. RE: how to reset/clear form fields after Modal closed - InsiteFX - 07-16-2022 How to clear all input fields in bootstrap modal when clicking data-dismiss button RE: how to reset/clear form fields after Modal closed - Ahmed Haroon - 07-18-2022 (07-16-2022, 12:49 AM)InsiteFX Wrote: How to clear all input fields in bootstrap modal when clicking data-dismiss button PHP Code: $('#modal1').on('hidden.bs.modal', function (e) { regards |