Skip to content

Commit

Permalink
[fix #4735] While adding new Menu item, if Menu title is kept blank t…
Browse files Browse the repository at this point in the history
…hen improper validation message is displayed.
  • Loading branch information
thongredweb committed Oct 20, 2014
1 parent 109ee91 commit eb7c235
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions administrator/components/com_menus/views/item/tmpl/edit.php
Expand Up @@ -69,7 +69,15 @@
Joomla.submitform('item.setType', document.id('item-form'));
} else if (task == 'item.cancel' || document.formvalidator.isValid(document.id('item-form')))
{
Joomla.submitform(task, document.id('item-form'));
if (document.id('jform_type').value == '') {
$('system-message').getElement('div').innerHTML = Joomla.JText._('JLIB_FORM_FIELD_INVALID');
$('system-message').getElement('div').innerHTML += Joomla.JText._('COM_MENUS_ITEM_FIELD_TYPE_LABEL');
$$('#jform_type').addClass('invalid');
$$('#jform_type-lbl').addClass('invalid');
}
else {
Joomla.submitform(task, document.id('item-form'));
}
}
else
{
Expand All @@ -86,14 +94,17 @@

if ($$('#item-form .modal-value').length > 0)
{
console.log($$('#item-form .modal-value'));
$('system-message').getElement('div').innerHTML = Joomla.JText._('JGLOBAL_VALIDATION_FORM_FAILED');
}
else if (document.id('jform_type').value == '')
{
$('system-message').getElement('div').innerHTML = Joomla.JText._('JLIB_FORM_FIELD_INVALID');
$('system-message').getElement('div').innerHTML += Joomla.JText._('COM_MENUS_ITEM_FIELD_TYPE_LABEL');
$$('#jform_type').addClass('invalid');
$$('#jform_type-lbl').addClass('invalid');
else if (document.formvalidator.isValid(document.id('item-form'))) {
if (document.id('jform_type').value == '')
{
$('system-message').getElement('div').innerHTML = Joomla.JText._('JLIB_FORM_FIELD_INVALID');
$('system-message').getElement('div').innerHTML += Joomla.JText._('COM_MENUS_ITEM_FIELD_TYPE_LABEL');
$$('#jform_type').addClass('invalid');
$$('#jform_type-lbl').addClass('invalid');
}
}
}
}
Expand Down

0 comments on commit eb7c235

Please sign in to comment.