Skip to content

Commit 7751880

Browse files
committed
Fixed multiple IDs bug
from w3c validator
1 parent 8cea18e commit 7751880

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

layouts/fields/checkbox.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
extract($displayData);
1111
$options = ModJDSimpleContactFormHelper::getOptions($field->options);
1212
$attrs = [];
13-
$attrs[] = 'id="' . $field->id . '"';
13+
$attrs[] = 'id="' . $field->name . '-' . $module->id .'"';
1414
if ($field->required) {
1515
$attrs[] = 'required';
1616
if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
@@ -21,8 +21,8 @@
2121
}
2222
?>
2323
<div class="form-check form-check-inline">
24-
<input class="form-check-input" type="checkbox" name="jdscf[<?php echo $field->name; ?>][cb]" value="1" id="<?php echo $field->name; ?>" <?php echo implode(' ', $attrs); ?> />
25-
<label class="form-check-label" for="<?php echo $field->name; ?>">
24+
<input class="form-check-input" type="checkbox" name="jdscf[<?php echo $field->name; ?>][cb]" value="1" <?php echo implode(' ', $attrs); ?> />
25+
<label class="form-check-label" for="<?php echo $field->name; ?>-<?php echo $module->id; ?>">
2626
<?php echo $label; ?>
2727
</label>
2828
</div>

layouts/fields/file.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
defined('_JEXEC') or die;
1010
extract($displayData);
1111
$attrs = [];
12-
$attrs[] = 'id="' . $field->id . '"';
12+
$attrs[] = 'id="' . $field->name . '-' . $module->id . '"';
1313
if ($field->required) {
14-
$attrs[] = 'required';
15-
if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
16-
$attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
17-
} else {
18-
$attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
19-
}
20-
}
21-
$attrs[] = 'id="' . $field->name . '-file-input"';
22-
//fetching allowed types
14+
$attrs[] = 'required';
15+
if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
16+
$attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
17+
} else {
18+
$attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
19+
}
20+
}
21+
22+
// fetching allowed types
2323
$params = JComponentHelper::getParams('com_media');
2424
$allowable = array_map('trim', explode(',', $params->get('upload_extensions')));
2525
$allowedMaxSize = $params->get('upload_maxsize');
@@ -34,7 +34,7 @@
3434
$document->addStyleDeclaration($style);
3535
?>
3636
<div class="custom-file">
37-
<input id="<?php echo $field->name; ?>-<?php echo $module->id; ?>" accept="<?php echo '.' . implode( ',.', $allowable ); ?>" type="file" name="jdscf[<?php echo $field->name; ?>]" class="custom-file-input" <?php echo implode(' ', $attrs); ?>>
37+
<input accept="<?php echo '.' . implode( ',.', $allowable ); ?>" type="file" name="jdscf[<?php echo $field->name; ?>]" class="custom-file-input" <?php echo implode(' ', $attrs); ?>>
3838
<label class="custom-file-label" for="<?php echo $field->name; ?>-<?php echo $module->id; ?>"><?php echo JText::_('MOD_JDSCF_FILE_LBL'); ?></label>
3939
</div>
4040

0 commit comments

Comments
 (0)