mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
add standard table input template
This commit is contained in:
parent
e9b5d28ceb
commit
dd03573465
@ -0,0 +1,20 @@
|
||||
<tr for="{{ id }}">
|
||||
<td >
|
||||
<label class="control-label" for="{{ id }}">{{label}}</label>
|
||||
</td>
|
||||
<td >
|
||||
{% if type == "text" %}
|
||||
<input type="text" class="form-control" size="{{size|default("50")}}" id="{{ id }}" >
|
||||
{% elseif type == "checkbox" %}
|
||||
<input type="checkbox" id="{{ id }}" >
|
||||
{% endif %}
|
||||
|
||||
{% if help|default(false) %}
|
||||
<br/>
|
||||
<small>{{help}}</small>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<span class="help-block" for="{{ id }}"></span>
|
||||
</td>
|
||||
</tr>
|
||||
@ -80,10 +80,13 @@ function setFormData(parent,data) {
|
||||
function handleFormValidation(parent,validationErrors) {
|
||||
$( "#"+parent+" input" ).each(function( index ) {
|
||||
if (validationErrors != undefined && $(this).attr('id') in validationErrors) {
|
||||
$(this).parent().addClass("has-error");
|
||||
//$(this).parent().addClass("has-error");
|
||||
$("*[for='" + $(this).attr('id') + "']").addClass("has-error");
|
||||
//$(this).addClass("has-error");
|
||||
$("span[for='" + $(this).attr('id') + "']").text(validationErrors[$(this).attr('id')]);
|
||||
} else {
|
||||
$(this).parent().removeClass("has-error");
|
||||
$("*[for='" + $(this).attr('id') + "']").removeClass("has-error");
|
||||
//$(this).removeClass("has-error");
|
||||
$("span[for='" + $(this).attr('id') + "']").text("");
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user