30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-03 06:50:49 +00:00

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::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.formvalidation'); JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
?> JFactory::getDocument()->addScriptDeclaration("
<script type="text/javascript">
Joomla.submitbutton = function(task) Joomla.submitbutton = function(task)
{ {
if (task == 'weblink.cancel' || document.formvalidator.isValid(document.id('weblink-form'))) { if (task == 'weblink.cancel' || document.formvalidator.isValid(document.getElementById('weblink-form'))) {
<?php echo $this->form->getField('description')->save(); ?> " . $this->form->getField('description')->save() . "
Joomla.submitform(task, document.getElementById('weblink-form')); 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"> <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); JHtml::_('sortablelist.sortable', 'weblinkList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
} }
$sortFields = $this->getSortFields(); $sortFields = $this->getSortFields();
?>
<script type="text/javascript"> JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function() Joomla.orderTable = function()
{ {
table = document.getElementById("sortTable"); table = document.getElementById("sortTable");
direction = document.getElementById("directionTable"); direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value; order = table.options[table.selectedIndex].value;
if (order != '<?php echo $listOrder; ?>') if (order != "' . $listOrder . '")
{ {
dirn = 'asc'; dirn = "asc";
} }
else else
{ {
dirn = direction.options[direction.selectedIndex].value; dirn = direction.options[direction.selectedIndex].value;
} }
Joomla.tableOrdering(order, dirn, ''); Joomla.tableOrdering(order, dirn, "");
} };
</script> ');
?>
<form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?> <?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">