PageSourceSearch

https://www.rigips.ch/site/Layout/v001/js/formValidateJS.cfm?version=429131881&corpId=10063&vsprache=de

js rigips.ch collected 2026-10-08 05:23:24 UTC 4,052 bytes, 152 lines download raw bytes

1
2let stResult = {};
3// Set Recaptcha in case customer uses this
4var captchaProtect = {
5'init' : false,
6'allow' : false
7}
8function recaptcha_result(result) {
9captchaProtect.allow = true;
10}
11/** **
12fb 03.02.21
13This customCallback function can be overwritten in the "standard.js" file from customer.
14Now we have the possibility to log the form
15ATTENTION there is ATM no async binding. The result of the customCallback must be "TRUE" without waiting on ajax calls
16Maybe this can be improved later...
17*/
18function customCallback() {
19return true
20}
21$(document).ready(function() {
22var allInputs = $("input");
23var emailIDs = [];
24allInputs.each(function(field) {
25if( $(allInputs[field]).attr('type') == 'text.email' ) {
26emailIDs.push($(allInputs[field]).attr('id'))
27}
28})
29$(".mpg-form button[type=submit]").on('click', function(e) {
30e.preventDefault();
31/**
32*	this parses the form and transforms it into a structure
33*/
34var $thisForm = $(this).closest('form.mpg-form');
35var aForm = $thisForm.serializeArray();
36var stForm = objectifyForm(aForm);
37/**
38*	Start validate Form
39*/
40mpFormValidate.init(
41{
42validationType : 'direct',
43form : $thisForm,
44notValidParent : '.row',
45messageParent : '.mpInputCol',
46fieldsEmail	: emailIDs,
47errorMsg : {
48required : "Bitte alle Pflichtfelder ausfüllen",
49emailNotValid : "Diese E-Mail Adresse ist nicht korrekt",
50compareFaild : "Die Felder stimmen nicht überein",
51},
52onSuccess : function() {
53var fActivateFormsRecaptcha = stForm.fActivateFormsRecaptcha == '1';
54if(fActivateFormsRecaptcha == 1){
55var recaptchaSiteKey = stForm.reCaptchaSiteKey;
56if(typeof grecaptcha !== "undefined"){
57try{
58grecaptcha.execute(recaptchaSiteKey, {action: "submit"})
59.then(function (token) {
60$thisForm.find('input[name="ReCaptchaToken"]').val(token);
61if( $thisForm.find('#dynamicRequest').length ) {
62$thisForm.submit();
63sessionStorage.removeItem(`frm_${window.location.hostname}_${window.location.pathname}`);
64}else{
65stForm['ReCaptchaToken'] = token;
66sendFormAjx(stForm, $thisForm);
67}
68})
69.catch(function (error) {
70console.error("ReCaptcha error:", error);
71$('form.mpg-form').html("ReCaptcha error");
72});
73}catch(error){
74console.error("ReCaptcha error:", error);
75$('form.mpg-form').html("ReCaptcha error");
76}
77}
78}
79else{
80if( $thisForm.find('#dynamicRequest').length ) {
81$thisForm.submit();
82sessionStorage.removeItem(`frm_${window.location.hostname}_${window.location.pathname}`);
83}else{
84sendFormAjx(stForm, $thisForm);
85}
86}
87}
88}
89);
90})
91});
92function sendFormAjx(stForm, thisForm){
93var data = $.param({
94formString: JSON.stringify(stForm),
95corp : 10063
96});
97$.ajax(
98{
99url: "/cfc/mp/proxy.cfc?method=sendForm&returnFormat=json",
100type: "POST",
101dataType: "json",
102data : data,
103success: function (resultData) {
104message(resultData, thisForm);
105sessionStorage.removeItem(`frm_${window.location.hostname}_${window.location.pathname}`);
106},
107error: function (error) {
108console.log(error);
109}
110}
111);
112}
113function objectifyForm(formArray) {
114var returnArray = {};
115for (var i = 0; i < formArray.length; i++){
116if( formArray[i]['name'].indexOf('checkbox-group') != -1 ) {
117var groupName = formArray[i]['name'].replace('[]', '');
118returnArray[groupName] = typeof(returnArray[groupName]) != 'undefined' ? returnArray[groupName] + ',' + formArray[i]['value'] : formArray[i]['value'];
119}else{
120returnArray[formArray[i]['name']] = formArray[i]['value'];
121}
122}
123return returnArray;
124}
125var resultData = {
126'data' : {
127'mailSent' : true,
128'answerUrl' : '',
129'answer' : ``,
130}
131}
132function message(resultData, thisForm, error) {
133let message = '<p class="form-error">' + messagesCache.translate(resultData.data.answer || '') + '<p>';
134if(error){
135$(thisForm).find('button[type=submit]').after(message);
136$('html, body').animate({
137scrollTop: $('button[type=submit]')?.offset()?.top - 300
138}, 500);
139setTimeout(()=>{
140$(thisForm).find('.form-error').remove();
141}, 10000);
142}
143else{
144if(resultData.data.answerUrl != '') {
145document.location = '/' + resultData.data.answerUrl;
146}else{
147thisForm.parent().append(resultData.data.answer);
148thisForm.hide();
149}
150}
151//alert('Es ist ein Fehler aufgetreten, das Formular wurde nicht gesendet.')
152}

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.