Merge pull request #2085 from NOYB/HTML_Compliance_-_MVC_Form_Input

HTML Compliance - MVC Form Input - Attribute "for" on Element <tr,div,a,small,span>
This commit is contained in:
Ad Schellevis 2018-02-06 16:33:22 +01:00 committed by GitHub
commit 2d4ef851ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

View File

@ -42,16 +42,16 @@ readonly : if true, input fields will be readonly
#}
<tr for="{{ id }}" {% if advanced|default(false)=='true' %} data-advanced="true"{% endif %}>
<tr id="row_{{ id }}" {% if advanced|default(false)=='true' %} data-advanced="true"{% endif %}>
<td >
<output class="control-label" for="{{ id }}">
<div class="control-label" id="control_label_{{ id }}">
{% if help|default(false) %}
<a id="help_for_{{ id }}" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a>
{% elseif help|default(false) == false %}
<i class="fa fa-info-circle text-muted"></i>
{% endif %}
<b>{{label}}</b>
</output>
</div>
</td>
<td >
{% if type == "text" %}
@ -60,7 +60,7 @@ readonly : if true, input fields will be readonly
<input type="checkbox" id="{{ id }}" >
{% elseif type == "select_multiple" %}
<select multiple="multiple" {% if size|default(false) %}size="{{size}}"{% endif %} id="{{ id }}" {% if style|default(false) %}class="{{style}}" {% endif %} {% if hint|default(false) %}data-hint="{{hint}}"{% endif %} {% if maxheight|default(false) %}data-maxheight="{{maxheight}}"{% endif %} data-width="{{width|default("348px")}}" data-allownew="{{allownew|default("false")}}" data-nbdropdownelements="{{nbDropdownElements|default("10")}}"></select>
<br/><a href="#" class="text-danger" id="clear-options" for="{{ id }}"><i class="fa fa-times-circle"></i></a> <small>{{ lang._('Clear All') }}</small>
<br/><a href="#" class="text-danger" id="clear-options_{{ id }}"><i class="fa fa-times-circle"></i></a> <small>{{ lang._('Clear All') }}</small>
{% elseif type == "dropdown" %}
<select {% if size|default(false) %}size="{{size}}"{% endif %} id="{{ id }}" class="{{style|default('selectpicker')}}" data-width="{{width|default("348px")}}"></select>
{% elseif type == "password" %}
@ -72,10 +72,12 @@ readonly : if true, input fields will be readonly
{% endif %}
{% if help|default(false) %}
<small class="hidden" for="help_for_{{ id }}" >{{help}}</small>
<output class="hidden" for="help_for_{{ id }}" >
<small>{{help}}</small>
</output>
{% endif %}
</td>
<td>
<span class="help-block" for="{{ id }}" ></span>
<span class="help-block" id="help_block_{{ id }}" ></span>
</td>
</tr>

View File

@ -162,11 +162,11 @@ function setFormData(parent,data) {
function handleFormValidation(parent,validationErrors) {
$( "#"+parent).find("*").each(function( index ) {
if (validationErrors != undefined && $(this).prop('id') in validationErrors) {
$("*[for='" + $(this).prop('id') + "']").addClass("has-error");
$("span[for='" + $(this).prop('id') + "']").text(validationErrors[$(this).prop('id')]);
$("*[id*='" + $(this).prop('id') + "']").addClass("has-error");
$("span[id='help_block_" + $(this).prop('id') + "']").text(validationErrors[$(this).prop('id')]);
} else {
$("*[for='" + $(this).prop('id') + "']").removeClass("has-error");
$("span[for='" + $(this).prop('id') + "']").text("");
$("*[id*='" + $(this).prop('id') + "']").removeClass("has-error");
$("span[id='help_block_" + $(this).prop('id') + "']").text("");
}
});
}

View File

@ -195,7 +195,7 @@ function formatTokenizersUI(){
function addMultiSelectClearUI() {
$('[id*="clear-options"]').each(function() {
$(this).click(function() {
var id = $(this).attr("for");
var id = $(this).attr("id").replace(/_*clear-options_*/, '');
BootstrapDialog.confirm({
title: 'Deselect or remove all items ?',
message: 'Deselect or remove all items ?',