'); option.text(val.title).val(val.id); $('#jform_parent_id').append(option); }); $('#jform_parent_id').trigger('liszt:updated'); }); }); }); Joomla.submitbutton = function(task, type){ if (task == 'item.setType' || task == 'item.setMenuType') { if (task == 'item.setType') { jQuery('#item-form input[name=\"jform[type]\"]').val(type); jQuery('#fieldtype').val('type'); } else { jQuery('#item-form input[name=\"jform[menutype]\"]').val(type); } Joomla.submitform('item.setType', document.getElementById('item-form')); } else if (task == 'item.cancel' || document.formvalidator.isValid(document.getElementById('item-form'))) { Joomla.submitform(task, document.getElementById('item-form')); } else { // special case for modal popups validation response jQuery('#item-form .modal-value.invalid').each(function(){ var field = jQuery(this), idReversed = field.attr('id').split('').reverse().join(''), separatorLocation = idReversed.indexOf('_'), nameId = '#' + idReversed.substr(separatorLocation).split('').reverse().join('') + 'name'; jQuery(nameId).addClass('invalid'); }); } }; "; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration($script); // In case of modal $input = JFactory::getApplication()->input; $isModal = $input->get('layout') == 'modal' ? true : false; $layout = $isModal ? 'modal' : 'edit'; $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; $clientId = $this->state->get('item.client_id', 0); ?>