Skip to content

Commit

Permalink
Fixed multiple IDs bug
Browse files Browse the repository at this point in the history
from w3c validator
  • Loading branch information
actuallyakash committed Jul 7, 2021
1 parent 8cea18e commit 7751880
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions layouts/fields/checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
extract($displayData);
$options = ModJDSimpleContactFormHelper::getOptions($field->options);
$attrs = [];
$attrs[] = 'id="' . $field->id . '"';
$attrs[] = 'id="' . $field->name . '-' . $module->id .'"';
if ($field->required) {
$attrs[] = 'required';
if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
Expand All @@ -21,8 +21,8 @@
}
?>
<div class="form-check form-check-inline">
<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); ?> />
<label class="form-check-label" for="<?php echo $field->name; ?>">
<input class="form-check-input" type="checkbox" name="jdscf[<?php echo $field->name; ?>][cb]" value="1" <?php echo implode(' ', $attrs); ?> />
<label class="form-check-label" for="<?php echo $field->name; ?>-<?php echo $module->id; ?>">
<?php echo $label; ?>
</label>
</div>
22 changes: 11 additions & 11 deletions layouts/fields/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
defined('_JEXEC') or die;
extract($displayData);
$attrs = [];
$attrs[] = 'id="' . $field->id . '"';
$attrs[] = 'id="' . $field->name . '-' . $module->id . '"';
if ($field->required) {
$attrs[] = 'required';
if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
$attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
} else {
$attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
}
}
$attrs[] = 'id="' . $field->name . '-file-input"';
//fetching allowed types
$attrs[] = 'required';
if (isset($field->custom_error) && !empty(trim($field->custom_error))) {
$attrs[] = 'data-parsley-required-message="' . JText::sprintf($field->custom_error) . '"';
} else {
$attrs[] = 'data-parsley-required-message="' . JText::sprintf('MOD_JDSCF_REQUIRED_ERROR', strip_tags($label)) . '"';
}
}

// fetching allowed types
$params = JComponentHelper::getParams('com_media');
$allowable = array_map('trim', explode(',', $params->get('upload_extensions')));
$allowedMaxSize = $params->get('upload_maxsize');
Expand All @@ -34,7 +34,7 @@
$document->addStyleDeclaration($style);
?>
<div class="custom-file">
<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); ?>>
<input accept="<?php echo '.' . implode( ',.', $allowable ); ?>" type="file" name="jdscf[<?php echo $field->name; ?>]" class="custom-file-input" <?php echo implode(' ', $attrs); ?>>
<label class="custom-file-label" for="<?php echo $field->name; ?>-<?php echo $module->id; ?>"><?php echo JText::_('MOD_JDSCF_FILE_LBL'); ?></label>
</div>

Expand Down

0 comments on commit 7751880

Please sign in to comment.