Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix#11155 Two finder module make invalid HTML for W3C #11168

Merged
merged 2 commits into from Jul 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions modules/mod_finder/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
$lang->load('com_finder', JPATH_SITE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 15 also MUST change to JHtml::_('formbehavior.chosen', '.advancedSelect'); because if you call chosen without any selector the it will be applied to all select elements in the page and thus will break any functionality for 3PD extension that have javascript that manipulates any selects.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


$suffix = $params->get('moduleclass_sfx');
$output = '<input type="text" name="q" id="mod-finder-searchword" class="search-query input-medium" size="'
$output = '<input type="text" name="q" id="mod-finder-searchword' . $module->id . '" class="search-query input-medium" size="'
. $params->get('field_size', 20) . '" value="' . htmlspecialchars(JFactory::getApplication()->input->get('q', '', 'string'), ENT_COMPAT, 'UTF-8') . '"'
. ' placeholder="' . JText::_('MOD_FINDER_SEARCH_VALUE') . '"/>';

$showLabel = $params->get('show_label', 1);
$labelClass = (!$showLabel ? 'element-invisible ' : '') . 'finder' . $suffix;
$label = '<label for="mod-finder-searchword" class="' . $labelClass . '">' . $params->get('alt_label', JText::_('JSEARCH_FILTER_SUBMIT')) . '</label>';
$label = '<label for="mod-finder-searchword' . $module->id . '" class="' . $labelClass . '">' . $params->get('alt_label', JText::_('JSEARCH_FILTER_SUBMIT')) . '</label>';

switch ($params->get('label_pos', 'left'))
{
Expand Down Expand Up @@ -77,7 +77,7 @@

$script = "
jQuery(document).ready(function() {
var value, searchword = jQuery('#mod-finder-searchword');
var value, searchword = jQuery('#mod-finder-searchword" . $module->id . "');

// Get the current value.
value = searchword.val();
Expand All @@ -104,10 +104,10 @@
}
});

jQuery('#mod-finder-searchform').on('submit', function (e)
jQuery('#mod-finder-searchform" . $module->id . "').on('submit', function (e)
{
e.stopPropagation();
var advanced = jQuery('#mod-finder-advanced');
var advanced = jQuery('#mod-finder-advanced" . $module->id . "');

// Disable select boxes with no value selected.
if (advanced.length)
Expand All @@ -131,7 +131,7 @@
JHtml::_('script', 'media/jui/js/jquery.autocomplete.min.js', false, false, false, false, true);

$script .= "
var suggest = jQuery('#mod-finder-searchword').autocomplete({
var suggest = jQuery('#mod-finder-searchword" . $module->id . "').autocomplete({
serviceUrl: '" . JRoute::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component') . "',
paramName: 'q',
minChars: 1,
Expand All @@ -147,7 +147,7 @@
JFactory::getDocument()->addScriptDeclaration($script);
?>

<form id="mod-finder-searchform" action="<?php echo JRoute::_($route); ?>" method="get" class="form-search">
<form id="mod-finder-searchform<?php echo $module->id; ?>" action="<?php echo JRoute::_($route); ?>" method="get" class="form-search">
<div class="finder<?php echo $suffix; ?>">
<?php
// Show the form fields.
Expand All @@ -159,7 +159,7 @@
<br />
<a href="<?php echo JRoute::_($route); ?>"><?php echo JText::_('COM_FINDER_ADVANCED_SEARCH'); ?></a>
<?php elseif ($show_advanced == 1) : ?>
<div id="mod-finder-advanced">
<div id="mod-finder-advanced<?php echo $module->id; ?>">
<?php echo JHtml::_('filter.select', $query, $params); ?>
</div>
<?php endif; ?>
Expand Down