PageSourceSearch

https://vfb-mittweida.de/public/www/themes/frontend/responsive/_public/src/js/form.js?_=6ab653e834f5c

js vfb-mittweida.de collected 2026-09-25 10:58:59 UTC 4,725 bytes, 108 lines download raw bytes

1var FORMS = {};
2    FORMS.Init = function(){
3        $('.form').each(function(){
4            if(!$(this).hasClass("isNL")){
5                $(this).find('.act a.btn.primary').bind('click',function(){
6                    var send = true;
7                    var _FORM = $(this).closest('.form');
8                    _FORM.find('input').each(function(){
9                        if($(this).attr("required") && $(this).attr("type")!="checkbox" && $.trim($(this).val())==""){
10                            $(this).addClass('error');
11                            send = false;
12                        }
13                        else{
14                            $(this).removeClass('error');
15                        }
16                    });
17                    _FORM.find('textarea').each(function(){
18                        if($(this).attr("required") && $.trim($(this).val())==""){
19                            $(this).addClass('error');
20                            send = false;
21                        }
22                        else{
23                            $(this).removeClass('error');
24                        }
25                    });
26                    _FORM.find('select').each(function(){
27                        if($(this).attr("required") && $.trim($(this).val())==""){
28                            $(this).addClass('error');
29                            send = false;
30                        }
31                        else{
32                            $(this).removeClass('error');
33                        }
34                    });
35                    _FORM.find('.input.cb input').each(function(){
36                        if($(this).attr("required") && $(this).prop("checked")==false){
37                            $(this).closest('.input').addClass('error');
38                            send = false;
39                        }
40                        else{
41                            $(this).closest('.input').removeClass('error');
42                        }
43                    });
44                    if(send == true){
45                        FORMS.sendForm(_FORM);
46                    }else{
47                        SYS.alert('Fehler','Sie haben nicht alle benötigten Felder vollständig ausgefüllt. Versuchen Sie es noch einmal.',false);
48                    }
49                });
50            }
51        });
52    };
53    FORMS.sendForm = function(_FORM){
54        SYS.info('Bitte warten','Der Versand Ihrer Nachricht wird vorbereitet. Bitte warten Sie einen kleinen Moment.');
55        var _DATA = {};
56        _FORM.find('input').each(function(){
57            if($(this).attr("type")!="checkbox"){
58                _DATA[$(this).attr("data-name")] = $(this).val();
59            }
60        });
61        _FORM.find('input[type="checkbox"]').each(function(){
62            if($(this).prop("checked")==true){
63                _DATA[$(this).attr("data-name")] = "y";
64            }else{
65                _DATA[$(this).attr("data-name")] = "n";
66            }
67        });
68        _FORM.find('input[type="radio"]').each(function(){
69            if($(this).prop("checked")==true){
70                _DATA[$(this).attr("data-name")] = $(this).val();
71            }
72        });
73        _FORM.find('select').each(function(){
74            _DATA[$(this).attr("data-name")] = $(this).val();
75        });
76        _FORM.find('textarea').each(function(){
77            _DATA[$(this).attr("data-name")] = $(this).val();
78        });
79
80        $.ajax({
81            method: "POST",
82            url: "./api",
83            data: { 
84                "do": "send_mail",
85                "data" : _DATA,
86                "_"     : Math.random()
87            },
88            success: function(data){
89                var API = JSON.parse(data);
90                if(!API.error){
91                    SYS.alert("Erfolgreich","Wir haben Ihre Nachricht erhalten und werden uns schnellst,öglich bei Ihnen persönlich melden.",function(){
92                        location.reload();
93                    });
94                }else{
95                    if(API.error == "403" || API.error == 403){
96                        SYS.alert("Fehlgeschlagen","Es liegt ein technischer Fehler vor. Die Nachricht konnte nicht zugestellt werden. Versuchen Sie es später noch einmal.",false); 
97                    }
98                    else if(API.error == "503" || API.error == 503){
99                        SYS.alert("Fehlgeschlagen","Sie können nur aller 5 Minuten eine Nachricht senden. Dies soll Spam vorbeugen. Versuchen Sie es später noc
99h einmal.",false); 
100                    }
101                }
102            }
103        });
104
105    }
106$(document).ready(function(){
107    FORMS.Init();
108});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.