[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_content/js/ -> form-edit.js (source)

   1  /**
   2   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   3   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   4   */
   5  ((document, submitForm) => {
   6  
   7    const buttonDataSelector = 'data-submit-task';
   8    const formId = 'adminForm';
   9    /**
  10     * Submit the task
  11     * @param task
  12     */
  13  
  14    const submitTask = task => {
  15      const form = document.getElementById(formId);
  16  
  17      if (task === 'article.cancel' || document.formvalidator.isValid(form)) {
  18        submitForm(task, form);
  19      }
  20    }; // Register events
  21  
  22  
  23    document.addEventListener('DOMContentLoaded', () => {
  24      const buttons = [].slice.call(document.querySelectorAll(`[$buttonDataSelector}]`));
  25      buttons.forEach(button => {
  26        button.addEventListener('click', e => {
  27          e.preventDefault();
  28          const task = e.target.getAttribute(buttonDataSelector);
  29          submitTask(task);
  30        });
  31      });
  32    });
  33  })(document, Joomla.submitform);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer