summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/widgets/CheckTextWidget.html
blob: 59ac79b5805206e2ace6ae19fbef55d6b36a01a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{% load l10n %}
<div class="input-group">
    <input class="area_widget form-control" type="text"{{final_attrs|safe}}>
    <div class="input-group-append">
        <div class="input-group-text" id="check-{{id}}">
            <i class="text-success fa fa-check"></i>
            <i class="text-danger fa fa-times"></i>
        </div>
    </div>
</div>
<script type="text/javascript">{% localize off %}
    $("#check-{{id}} .text-danger").hide();
    $("#check-{{id}} .text-success").hide();
    function evaluate_{{safe_id}}(){
        value = $("#{{id}}").val();
        if ({{validator}}(value)){
            $("#check-{{id}} .text-danger").hide();
            $("#check-{{id}} .text-success").show();
        } else {
            $("#check-{{id}} .text-danger").show();
            $("#check-{{id}} .text-success").hide();
        }
    }
    $("#{{id}}").keyup(evaluate_{{safe_id}});
    $(document).ready(evaluate_{{safe_id}}());
{% endlocalize %}</script>