Merge pull request #18 from dgt41/jquery_1

Introduce jquery formvalidator for com_weblinks
This commit is contained in:
George Wilson 2015-02-08 02:33:06 +00:00
commit 67d0850975
2 changed files with 15 additions and 14 deletions

View File

@ -11,19 +11,19 @@ defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
?>
<script type="text/javascript">
JFactory::getDocument()->addScriptDeclaration("
Joomla.submitbutton = function(task)
{
if (task == 'weblink.cancel' || document.formvalidator.isValid(document.id('weblink-form'))) {
<?php echo $this->form->getField('description')->save(); ?>
if (task == 'weblink.cancel' || document.formvalidator.isValid(document.getElementById('weblink-form'))) {
" . $this->form->getField('description')->save() . "
Joomla.submitform(task, document.getElementById('weblink-form'));
}
}
</script>
};
");
?>
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="weblink-form" class="form-validate">

View File

@ -27,24 +27,25 @@ if ($saveOrder)
JHtml::_('sortablelist.sortable', 'weblinkList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
$sortFields = $this->getSortFields();
?>
<script type="text/javascript">
JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>')
if (order != "' . $listOrder . '")
{
dirn = 'asc';
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">