Commit dd035734 authored by Ad Schellevis's avatar Ad Schellevis

add standard table input template

parent e9b5d28c
<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>
\ No newline at end of file
...@@ -80,10 +80,13 @@ function setFormData(parent,data) { ...@@ -80,10 +80,13 @@ function setFormData(parent,data) {
function handleFormValidation(parent,validationErrors) { function handleFormValidation(parent,validationErrors) {
$( "#"+parent+" input" ).each(function( index ) { $( "#"+parent+" input" ).each(function( index ) {
if (validationErrors != undefined && $(this).attr('id') in validationErrors) { 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')]); $("span[for='" + $(this).attr('id') + "']").text(validationErrors[$(this).attr('id')]);
} else { } else {
$(this).parent().removeClass("has-error"); $("*[for='" + $(this).attr('id') + "']").removeClass("has-error");
//$(this).removeClass("has-error");
$("span[for='" + $(this).attr('id') + "']").text(""); $("span[for='" + $(this).attr('id') + "']").text("");
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment