Back to ConfirmButton class

Method _getCommand

protected string
_getCommand
()
Get the JavaScript command for the button
Returns
  • string JavaScript command string
Since
  • 3.0
Class: ConfirmButton
Project: Joomla

Method _getCommand - Source code

/**
 * Get the JavaScript command for the button
 *
 * @return  string  JavaScript command string
 *
 * @since   3.0
 */
protected function _getCommand()
{
    Text::script($this->getListCheckMessage() ?: 'JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
    Text::script('ERROR');
    $msg = $this->getMessage();
    $cmd = "if (confirm('" . $msg . "')) { Joomla.submitbutton('" . $this->getTask() . "'); }";
    if ($this->getListCheck()) {
        $message = "{'error': [Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
        $alert = 'Joomla.renderMessages(' . $message . ')';
        $cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }';
    }
    return $cmd;
}