hr-design-system-handlebars 1.113.1 → 1.113.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/assets/index.css +38 -8
- package/dist/assets/js/alpine.js +2 -1
- package/dist/assets/js/components/forms/js/contactForm.alpine.js +34 -99
- package/dist/assets/js/components/forms/js/inputHandler.alpine.js +2 -36
- package/dist/views/components/forms/components/controls.hbs +1 -1
- package/dist/views/components/forms/components/input.hbs +1 -1
- package/dist/views/components/forms/components/message.hbs +4 -1
- package/dist/views/components/forms/components/textarea.hbs +1 -2
- package/dist/views/components/forms/webform.hbs +28 -11
- package/dist/views_static/components/forms/components/controls.hbs +1 -1
- package/dist/views_static/components/forms/components/input.hbs +1 -1
- package/dist/views_static/components/forms/components/message.hbs +4 -1
- package/dist/views_static/components/forms/components/textarea.hbs +1 -2
- package/dist/views_static/components/forms/webform.hbs +28 -11
- package/package.json +1 -1
- package/src/assets/css/custom-utilities.css +1 -1
- package/src/assets/fixtures/content/copytext/copytext_webform.json +6 -1
- package/src/assets/fixtures/content/copytext/copytext_webform_simple.json +32 -0
- package/src/assets/fixtures/forms/error_messages.inc.json +3 -0
- package/src/assets/js/alpine.js +2 -1
- package/src/stories/views/components/content/copytext/copytext-form.stories.js +52 -1
- package/src/stories/views/components/content/copytext/fixtures/copytext_webform.json +1 -1
- package/src/stories/views/components/content/copytext/fixtures/copytext_webform_simple.json +1 -0
- package/src/stories/views/components/forms/components/controls.hbs +1 -1
- package/src/stories/views/components/forms/components/input.hbs +1 -1
- package/src/stories/views/components/forms/components/message.hbs +4 -1
- package/src/stories/views/components/forms/components/textarea.hbs +1 -2
- package/src/stories/views/components/forms/js/contactForm.alpine.js +34 -99
- package/src/stories/views/components/forms/js/inputHandler.alpine.js +2 -36
- package/src/stories/views/components/forms/webform.hbs +28 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# v1.113.2 (Mon Oct 28 2024)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Form validation script optimization [#1128](https://github.com/mumprod/hr-design-system-handlebars/pull/1128) ([@vascoeduardo](https://github.com/vascoeduardo) [@eduardo-hr](https://github.com/eduardo-hr))
|
|
6
|
+
|
|
7
|
+
#### Authors: 2
|
|
8
|
+
|
|
9
|
+
- [@eduardo-hr](https://github.com/eduardo-hr)
|
|
10
|
+
- Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
1
14
|
# v1.113.1 (Mon Oct 28 2024)
|
|
2
15
|
|
|
3
16
|
#### 🐛 Bug Fix
|
package/dist/assets/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.-translate-x-1\/2, .-translate-x-2\/4, .-translate-y-1\/2, .translate-x-0, .translate-y-0, .translate-y-12, .translate-y-3, .translate-y-8, .-rotate-45, .rotate-180, .rotate-45, .scale-100, .scale-50, .scale-75, .scale-y-100, .scale-y-90, .transform, .is-loading::after, label, .hover\:scale-105, .active\:scale-95, .peer-placeholder-shown\:translate-x-0, .peer-placeholder-shown\:translate-y-3, .peer-placeholder-shown\:scale-100, .peer-focus\:translate-x-0, .peer-focus\:translate-y-0, .peer-focus\:rotate-180, .peer-focus\:scale-75 {
|
|
1
|
+
.-translate-x-1\/2, .-translate-x-2\/4, .-translate-y-1\/2, .translate-x-0, .translate-y-0, .translate-y-12, .translate-y-3, .translate-y-8, .-rotate-45, .rotate-180, .rotate-45, .scale-100, .scale-50, .scale-75, .scale-90, .scale-y-100, .scale-y-90, .transform, .is-loading::after, label, .hover\:scale-105, .active\:scale-95, .peer-placeholder-shown\:translate-x-0, .peer-placeholder-shown\:translate-y-3, .peer-placeholder-shown\:scale-100, .peer-focus\:translate-x-0, .peer-focus\:translate-y-0, .peer-focus\:rotate-180, .peer-focus\:scale-75 {
|
|
2
2
|
--tw-translate-x: 0;
|
|
3
3
|
--tw-translate-y: 0;
|
|
4
4
|
--tw-rotate: 0;
|
|
@@ -2013,6 +2013,12 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
2013
2013
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(.75) scaleY(.75);
|
|
2014
2014
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2015
2015
|
}
|
|
2016
|
+
.scale-90 {
|
|
2017
|
+
--tw-scale-x: .9;
|
|
2018
|
+
--tw-scale-y: .9;
|
|
2019
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(.9) scaleY(.9);
|
|
2020
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
2021
|
+
}
|
|
2016
2022
|
.scale-y-100 {
|
|
2017
2023
|
--tw-scale-y: 1;
|
|
2018
2024
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(1);
|
|
@@ -2932,6 +2938,10 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
2932
2938
|
padding-top: 2rem;
|
|
2933
2939
|
padding-bottom: 2rem;
|
|
2934
2940
|
}
|
|
2941
|
+
.py-px {
|
|
2942
|
+
padding-top: 1px;
|
|
2943
|
+
padding-bottom: 1px;
|
|
2944
|
+
}
|
|
2935
2945
|
.pb-0 {
|
|
2936
2946
|
padding-bottom: 0px;
|
|
2937
2947
|
}
|
|
@@ -2975,9 +2985,6 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
2975
2985
|
padding-bottom: 16px;
|
|
2976
2986
|
padding-bottom: var(--footer-padding-bottom);
|
|
2977
2987
|
}
|
|
2978
|
-
.pb-px {
|
|
2979
|
-
padding-bottom: 1px;
|
|
2980
|
-
}
|
|
2981
2988
|
.pl-10 {
|
|
2982
2989
|
padding-left: 2.5rem;
|
|
2983
2990
|
}
|
|
@@ -3564,6 +3571,9 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
3564
3571
|
.delay-300 {
|
|
3565
3572
|
transition-delay: 300ms;
|
|
3566
3573
|
}
|
|
3574
|
+
.delay-75 {
|
|
3575
|
+
transition-delay: 75ms;
|
|
3576
|
+
}
|
|
3567
3577
|
.duration-0 {
|
|
3568
3578
|
transition-duration: 0ms;
|
|
3569
3579
|
}
|
|
@@ -3585,6 +3595,9 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
3585
3595
|
.duration-700 {
|
|
3586
3596
|
transition-duration: 700ms;
|
|
3587
3597
|
}
|
|
3598
|
+
.duration-75 {
|
|
3599
|
+
transition-duration: 75ms;
|
|
3600
|
+
}
|
|
3588
3601
|
.ease-\[cubic-bezier\(0\.68\2c -0\.3\2c 0\.32\2c 1\)\] {
|
|
3589
3602
|
transition-timing-function: cubic-bezier(0.68,-0.3,0.32,1);
|
|
3590
3603
|
}
|
|
@@ -3605,7 +3618,7 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
3605
3618
|
border-bottom-color: var(--color-secondary-ds);
|
|
3606
3619
|
}
|
|
3607
3620
|
.counter-reset {
|
|
3608
|
-
counter-reset:
|
|
3621
|
+
counter-reset: cnt1730149384842;
|
|
3609
3622
|
}
|
|
3610
3623
|
.placeholder-text-xs::-webkit-input-placeholder {
|
|
3611
3624
|
font-size: 0.75rem;
|
|
@@ -4019,7 +4032,7 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
4019
4032
|
--tw-ring-color: rgba(255, 255, 255, 0.5);
|
|
4020
4033
|
}
|
|
4021
4034
|
.-ordered {
|
|
4022
|
-
counter-increment:
|
|
4035
|
+
counter-increment: cnt1730149384842 1;
|
|
4023
4036
|
}
|
|
4024
4037
|
.-ordered::before {
|
|
4025
4038
|
position: absolute;
|
|
@@ -4037,7 +4050,7 @@ article.indexTextDS .indexTextHighlighted .link {
|
|
|
4037
4050
|
--tw-text-opacity: 1;
|
|
4038
4051
|
color: rgba(0, 0, 0, 1);
|
|
4039
4052
|
color: rgba(0, 0, 0, var(--tw-text-opacity));
|
|
4040
|
-
content: counter(
|
|
4053
|
+
content: counter(cnt1730149384842);
|
|
4041
4054
|
}
|
|
4042
4055
|
/*! ****************************/
|
|
4043
4056
|
/*! DataPolicy stuff */
|
|
@@ -4171,6 +4184,9 @@ select:has(option:checked:not([value=''])) + label {
|
|
|
4171
4184
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important;
|
|
4172
4185
|
}
|
|
4173
4186
|
select:has(option:checked[value='']) {
|
|
4187
|
+
-webkit-user-select: none;
|
|
4188
|
+
-moz-user-select: none;
|
|
4189
|
+
user-select: none;
|
|
4174
4190
|
color: transparent;
|
|
4175
4191
|
}
|
|
4176
4192
|
.form-checkbox:checked::after {
|
|
@@ -5911,6 +5927,19 @@ select:has(option:checked[value='']) {
|
|
|
5911
5927
|
}
|
|
5912
5928
|
}
|
|
5913
5929
|
}
|
|
5930
|
+
.placeholder\:select-none::-webkit-input-placeholder {
|
|
5931
|
+
-webkit-user-select: none;
|
|
5932
|
+
user-select: none;
|
|
5933
|
+
}
|
|
5934
|
+
.placeholder\:select-none::-moz-placeholder {
|
|
5935
|
+
-moz-user-select: none;
|
|
5936
|
+
user-select: none;
|
|
5937
|
+
}
|
|
5938
|
+
.placeholder\:select-none::placeholder {
|
|
5939
|
+
-webkit-user-select: none;
|
|
5940
|
+
-moz-user-select: none;
|
|
5941
|
+
user-select: none;
|
|
5942
|
+
}
|
|
5914
5943
|
.placeholder\:text-gray-dark::-webkit-input-placeholder {
|
|
5915
5944
|
--tw-text-opacity: 1;
|
|
5916
5945
|
color: rgba(112, 112, 112, 1);
|
|
@@ -6079,7 +6108,8 @@ select:has(option:checked[value='']) {
|
|
|
6079
6108
|
background-color: rgba(0, 0, 0, 1);
|
|
6080
6109
|
background-color: rgba(0, 0, 0, var(--tw-bg-opacity));
|
|
6081
6110
|
}
|
|
6082
|
-
.focus\:
|
|
6111
|
+
.focus\:py-0:focus {
|
|
6112
|
+
padding-top: 0px;
|
|
6083
6113
|
padding-bottom: 0px;
|
|
6084
6114
|
}
|
|
6085
6115
|
.focus\:text-white:focus {
|
package/dist/assets/js/alpine.js
CHANGED
|
@@ -54,7 +54,8 @@ Alpine.store('sharingBottomPos', {
|
|
|
54
54
|
})
|
|
55
55
|
Alpine.store('forms', {
|
|
56
56
|
submissionAttempted: [],
|
|
57
|
-
serverErrorFields: [{}]
|
|
57
|
+
serverErrorFields: [{}],
|
|
58
|
+
errorMessages: [{}]
|
|
58
59
|
})
|
|
59
60
|
// Initialization of data handlers
|
|
60
61
|
Alpine.data('mainNavigationHandler', mainNavigationHandler)
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
2
|
+
|
|
1
3
|
export default function contactForm(formId, jsonUrl, errorMessages, multipart, trackingInformations, jsonp = false) {
|
|
2
4
|
return {
|
|
3
5
|
isPosting: false,
|
|
4
|
-
|
|
6
|
+
wasPosted: false,
|
|
7
|
+
wasPostedWithSuccess: false,
|
|
8
|
+
wasPostedWithError: false,
|
|
9
|
+
isWebview: window.parent.document.documentElement.classList.contains('webview'),
|
|
5
10
|
ajaxTimeout: 60 * 1000,
|
|
6
11
|
form: this.$refs[formId],
|
|
7
12
|
formWrapper: this.$refs[formId].closest("#formWrapper"),
|
|
@@ -13,47 +18,20 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
13
18
|
},
|
|
14
19
|
formInit(){
|
|
15
20
|
this.checkForJsonURL()
|
|
16
|
-
console.log("%cformId:", 'color: green' ,formId);
|
|
17
|
-
console.log("%cform:", 'color: green' ,this.form);
|
|
18
|
-
console.log("%cformWrapper:", 'color: green' ,this.formWrapper);
|
|
19
|
-
console.log("%cactionUrl:", 'color: green' ,this.actionUrl);
|
|
20
|
-
console.log("%cjsonUrl:", 'color: green', jsonUrl);
|
|
21
|
-
console.log("%cerrorMessages:", 'color: green', errorMessages);
|
|
22
|
-
console.log("%cmultipart:", 'color: green', multipart);
|
|
23
|
-
console.log("%ctrackingInformations:", 'color: green', trackingInformations);
|
|
24
|
-
|
|
25
21
|
this.$store.forms.submissionAttempted[formId] = false;
|
|
22
|
+
this.$store.forms.errorMessages = JSON.parse( "{" + errorMessages.replace(/"/g,'"') + "}")
|
|
26
23
|
},
|
|
27
|
-
|
|
28
|
-
console.log("event:",event);
|
|
29
|
-
console.log('check for Error:',formId);
|
|
30
|
-
console.log('form:',this.form);
|
|
31
|
-
|
|
24
|
+
submitButtonHandler(event) {
|
|
32
25
|
if(this.form.reportValidity()){
|
|
33
|
-
// this.logData(event,form);
|
|
34
26
|
this.handleSubmit(event,this.form)
|
|
35
27
|
} else {
|
|
36
28
|
this.$store.forms.submissionAttempted[formId] = true;
|
|
37
29
|
}
|
|
38
30
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const fields = Array.from(form.elements);
|
|
43
|
-
// Log the serialized form data
|
|
44
|
-
console.log(fields);
|
|
45
|
-
|
|
46
|
-
// Convert the FormData to a serialized string
|
|
47
|
-
const serializedData = Array.from(formData.entries())
|
|
48
|
-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
49
|
-
.join('&');
|
|
50
|
-
|
|
51
|
-
// Log the serialized form data
|
|
52
|
-
console.log('serialized DATA: ' + serializedData);
|
|
53
|
-
console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
|
|
54
|
-
|
|
31
|
+
retryHandler() {
|
|
32
|
+
this.wasPosted = false;
|
|
33
|
+
this.wasPostedWithError = false;
|
|
55
34
|
},
|
|
56
|
-
// TODO - Validation error handler (adapt to your case)
|
|
57
35
|
handleValidationErrors(errors) {
|
|
58
36
|
console.log('Validation Errors:', errors);
|
|
59
37
|
this.$store.forms.serverErrorFields[formId] = errors;
|
|
@@ -61,29 +39,19 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
61
39
|
},
|
|
62
40
|
resetValidationErrors() {
|
|
63
41
|
this.$store.forms.serverErrorFields[formId] = {}
|
|
64
|
-
},
|
|
65
|
-
|
|
42
|
+
},
|
|
66
43
|
handleSubmit(event, form ) {
|
|
67
44
|
event.preventDefault();
|
|
68
45
|
|
|
69
|
-
if (!this.isWebview) {
|
|
70
|
-
|
|
46
|
+
if (!this.isWebview) {
|
|
47
|
+
uxAction(trackingInformations);
|
|
71
48
|
}
|
|
72
49
|
|
|
73
50
|
if (this.isPosting) return;
|
|
74
51
|
this.isPosting = true;
|
|
75
52
|
|
|
76
|
-
// TODO mit alpine umsetzen
|
|
77
|
-
//const preloadIcon = formWrapper.querySelector('.js-preloadIcon');
|
|
78
|
-
//const loadingIcon = formWrapper.querySelector('.js-loadingIcon');
|
|
79
|
-
|
|
80
|
-
// Show loading indicator
|
|
81
|
-
//preloadIcon.classList.add('-isHidden');
|
|
82
|
-
//loadingIcon.classList.remove('-isHidden');
|
|
83
|
-
|
|
84
53
|
console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
|
|
85
54
|
|
|
86
|
-
// Define ajaxOptions based on form type (without jQuery $.ajax)
|
|
87
55
|
let ajaxOptions = {
|
|
88
56
|
method: jsonp ? 'GET' : 'POST',
|
|
89
57
|
headers: {
|
|
@@ -96,13 +64,13 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
96
64
|
if (jsonp) {
|
|
97
65
|
ajaxOptions.url = this.actionUrl;
|
|
98
66
|
ajaxOptions.headers['Content-Type'] = 'application/json; charset=utf-8';
|
|
99
|
-
ajaxOptions.body = new URLSearchParams(new FormData(form)).toString();
|
|
67
|
+
ajaxOptions.body = new URLSearchParams(new FormData(form)).toString();
|
|
100
68
|
} else if (multipart) {
|
|
101
69
|
ajaxOptions = {
|
|
102
70
|
method: 'POST',
|
|
103
71
|
url: this.actionUrl,
|
|
104
72
|
timeout: 600 * 1000,
|
|
105
|
-
body: new FormData(form),
|
|
73
|
+
body: new FormData(form),
|
|
106
74
|
processData: false,
|
|
107
75
|
headers: {}
|
|
108
76
|
};
|
|
@@ -110,10 +78,9 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
110
78
|
ajaxOptions.url = `${this.actionUrl}?${responseFormatParam}`;
|
|
111
79
|
}
|
|
112
80
|
|
|
113
|
-
// Using fetch API instead of $.ajax
|
|
114
81
|
fetch(ajaxOptions.url, ajaxOptions)
|
|
115
82
|
.then(async (response) => {
|
|
116
|
-
const data = await response.text();
|
|
83
|
+
const data = await response.text();
|
|
117
84
|
if (response.ok) {
|
|
118
85
|
console.log('Done');
|
|
119
86
|
console.log(data);
|
|
@@ -126,74 +93,42 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
126
93
|
break;
|
|
127
94
|
case 'OK':
|
|
128
95
|
console.log("OK");
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
this.form.querySelector('#successMessage').innerHTML,
|
|
132
|
-
true
|
|
133
|
-
);
|
|
96
|
+
this.wasPosted = true;
|
|
97
|
+
this.wasPostedWithSuccess = true;
|
|
134
98
|
break;
|
|
135
99
|
default:
|
|
136
100
|
console.log("default");
|
|
137
|
-
this.
|
|
138
|
-
|
|
139
|
-
this.form.querySelector('#errorMessage').innerHTML,
|
|
140
|
-
true
|
|
141
|
-
);
|
|
101
|
+
this.wasPosted = true;
|
|
102
|
+
this.wasPostedWithError = true;
|
|
142
103
|
break;
|
|
143
104
|
}
|
|
144
105
|
} else {
|
|
145
|
-
|
|
106
|
+
|
|
107
|
+
this.wasPosted = true;
|
|
108
|
+
this.wasPostedWithError = true;
|
|
146
109
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} */
|
|
151
|
-
|
|
152
|
-
/* if (rootElement.id) {
|
|
153
|
-
window.location.hash = rootElement.id;
|
|
154
|
-
} */
|
|
110
|
+
if (formId) {
|
|
111
|
+
window.location.hash = formId;
|
|
112
|
+
}
|
|
155
113
|
} else {
|
|
114
|
+
this.wasPosted = true;
|
|
115
|
+
this.wasPostedWithError = true;
|
|
156
116
|
throw new Error('Network response was not ok.');
|
|
117
|
+
|
|
157
118
|
}
|
|
158
119
|
})
|
|
159
120
|
.catch((error) => {
|
|
160
121
|
console.error('Fail:', error);
|
|
161
|
-
this.
|
|
162
|
-
|
|
163
|
-
'<div class="c-form success">Das hat leider nicht funktioniert!</div>',
|
|
164
|
-
true
|
|
165
|
-
);
|
|
122
|
+
this.wasPosted = true;
|
|
123
|
+
this.wasPostedWithError = true;
|
|
166
124
|
})
|
|
167
125
|
.finally(() => {
|
|
168
126
|
console.log('Always');
|
|
169
|
-
// TODO MIT ALPINE UMSETZEN
|
|
170
|
-
//preloadIcon.classList.remove('-isHidden');
|
|
171
|
-
//loadingIcon.classList.add('-isHidden');
|
|
172
127
|
this.isPosting = false;
|
|
173
128
|
});
|
|
174
129
|
},
|
|
175
|
-
// Helper function to replace content with animation (replacing hrQuery's replaceAnimated)
|
|
176
|
-
replaceAnimated(wrapper, newContent, withFade = true) {
|
|
177
|
-
if (withFade) {
|
|
178
|
-
wrapper.style.opacity = 0;
|
|
179
|
-
setTimeout(() => {
|
|
180
|
-
wrapper.innerHTML = newContent;
|
|
181
|
-
wrapper.style.opacity = 1;
|
|
182
|
-
}, 300);
|
|
183
|
-
} else {
|
|
184
|
-
wrapper.innerHTML = newContent;
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
// Fire event utility (could be Alpine.js specific or custom)
|
|
188
|
-
fireEvent(eventName, success){
|
|
189
|
-
const event = new CustomEvent(eventName, { detail: success });
|
|
190
|
-
document.dispatchEvent(event);
|
|
191
|
-
},
|
|
192
130
|
getSubmissionAttempted() {
|
|
193
131
|
return this.$store.forms.submissionAttempted[formId]
|
|
194
|
-
}
|
|
195
|
-
|
|
132
|
+
}
|
|
196
133
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
134
|
+
}
|
|
@@ -90,42 +90,8 @@ export default function inputHandler(element, formId, errorMandatory, type, erro
|
|
|
90
90
|
return Boolean(this.$store.forms.serverErrorFields[formId]?.[name]);
|
|
91
91
|
},
|
|
92
92
|
getServerError() {
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
case 'form_error_required':
|
|
97
|
-
serverError += "Pflichtfeld"
|
|
98
|
-
break
|
|
99
|
-
case 'form_error_max':
|
|
100
|
-
serverError += "Zu viele Zeichen"
|
|
101
|
-
break
|
|
102
|
-
case 'form_error_validurl':
|
|
103
|
-
serverError += "Ungültige URL"
|
|
104
|
-
break
|
|
105
|
-
case 'form_error_empty':
|
|
106
|
-
serverError += "Darf nicht ausgefüllt werden"
|
|
107
|
-
break
|
|
108
|
-
case 'form_error_constants_or_null':
|
|
109
|
-
serverError += "Ungültiger Wert"
|
|
110
|
-
break
|
|
111
|
-
case 'form_error_constants':
|
|
112
|
-
serverError += "Ungültiger Wert"
|
|
113
|
-
break
|
|
114
|
-
case 'form_error_max_multivalue':
|
|
115
|
-
serverError += "Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten"
|
|
116
|
-
break
|
|
117
|
-
case 'vote_error_identity_already_used':
|
|
118
|
-
serverError += "Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich."
|
|
119
|
-
break
|
|
120
|
-
case 'vote_error_token_request_count_exceeded':
|
|
121
|
-
serverError += "Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt."
|
|
122
|
-
break
|
|
123
|
-
case 'form_error_email':
|
|
124
|
-
serverError += "Ungültige E-Mail-Adresse"
|
|
125
|
-
break
|
|
126
|
-
default:
|
|
127
|
-
return false
|
|
128
|
-
}
|
|
93
|
+
let errorName = this.$store.forms.serverErrorFields[formId][name]
|
|
94
|
+
let serverError = this.$store.forms.errorMessages[errorName]
|
|
129
95
|
return serverError
|
|
130
96
|
}
|
|
131
97
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
|
|
5
5
|
<span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
|
|
6
6
|
<span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
|
|
7
|
-
<input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="
|
|
7
|
+
<input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="submitButtonHandler($event)"/>
|
|
8
8
|
</label>
|
|
9
9
|
|
|
10
10
|
{{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
x-init="validateField()"
|
|
5
5
|
x-ignore
|
|
6
6
|
>
|
|
7
|
-
<input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
7
|
+
<input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white placeholder:select-none text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
8
8
|
:class="{'border-form-highlight dark:form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
|
|
9
9
|
x-model="input{{getRandom}}"
|
|
10
10
|
id="input{{getRandom}}"
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
{{/if}}
|
|
10
10
|
</div>
|
|
11
11
|
{{#unless _success}}
|
|
12
|
-
{{#> components/button/button _variant="primary"_size="lg"
|
|
12
|
+
{{#> components/button/button _variant="primary"_size="lg" }}
|
|
13
13
|
<span class="text-base ds-button-label ">Nochmal versuchen</span>
|
|
14
14
|
{{/components/button/button}}
|
|
15
|
+
{{#*inline "htmlProperties"}}
|
|
16
|
+
@click="retryHandler"
|
|
17
|
+
{{/inline}}
|
|
15
18
|
{{/unless}}
|
|
16
19
|
</div>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<div class="w-full h-4 bg-white dark:bg-black dark:text-text-dark"></div>
|
|
8
8
|
<textarea
|
|
9
|
-
class="relative w-full pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9
|
|
9
|
+
class="relative w-full py-px pl-4 placeholder-transparent bg-white placeholder:select-none dark:border-form-highlight-dark min-h-12 peer focus:border-b-2 focus:py-0 text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
10
10
|
x-model="textarea{{getRandom}}"
|
|
11
11
|
id="textarea{{getRandom}}"
|
|
12
12
|
{{#if _required}}
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
maxlength="{{_maxLength}}"
|
|
36
36
|
{{/if~}}
|
|
37
37
|
{{#if _required}}required{{/if}}
|
|
38
|
-
class="relative w-full px-4 pb-px text-black placeholder-transparent bg-white border-form-highlight dark:border-form-highlight-dark min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
|
|
39
38
|
{{#if _required}}
|
|
40
39
|
:class="{'border-form-highlight dark:border-form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
|
|
41
40
|
{{/if}}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{{~#if _newWebForm ~}}
|
|
2
|
-
{{#>components/forms/components/backgroundBox }}
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
{{#>components/forms/components/backgroundBox }}
|
|
5
3
|
<h3 class="mb-6 text-2xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
6
4
|
{{this.title}}
|
|
7
5
|
</h3>
|
|
@@ -21,20 +19,39 @@
|
|
|
21
19
|
enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}"
|
|
22
20
|
accept-charset="utf-8"
|
|
23
21
|
|
|
22
|
+
>
|
|
23
|
+
<div x-show="!wasPosted"
|
|
24
|
+
x-transition:enter="transition ease-out duration-300 delay-300"
|
|
25
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
26
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
27
|
+
x-transition:leave="transition ease-in duration-75 delay-0"
|
|
28
|
+
x-transition:leave-start="opacity-100 transform scale-100"
|
|
29
|
+
x-transition:leave-end="opacity-0 transform scale-90"
|
|
24
30
|
>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{{> components/forms/components/controls }}
|
|
31
|
+
{{> components/forms/components/fields _formId=(joinStrings 'form' (getRandom)) }}
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
{{> components/forms/components/controls }}
|
|
34
|
+
</div>
|
|
35
|
+
<div id="successMessage" x-show="wasPostedWithSuccess"
|
|
36
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
37
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
38
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
39
|
+
x-cloak
|
|
40
|
+
>
|
|
30
41
|
{{> components/forms/components/message _success=true }}
|
|
31
|
-
</
|
|
42
|
+
</div>
|
|
32
43
|
|
|
33
|
-
<
|
|
44
|
+
<div id="errorMessage" x-show="wasPostedWithError"
|
|
45
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
46
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
47
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
48
|
+
x-cloak>
|
|
34
49
|
{{> components/forms/components/message _success=false }}
|
|
35
|
-
</
|
|
36
|
-
|
|
50
|
+
</div>
|
|
51
|
+
|
|
37
52
|
</form>
|
|
53
|
+
|
|
54
|
+
|
|
38
55
|
</div>
|
|
39
56
|
{{/components/forms/components/backgroundBox }}
|
|
40
57
|
{{~else~}}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
|
|
5
5
|
<span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
|
|
6
6
|
<span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
|
|
7
|
-
<input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="
|
|
7
|
+
<input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="submitButtonHandler($event)"/>
|
|
8
8
|
</label>
|
|
9
9
|
|
|
10
10
|
{{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
x-init="validateField()"
|
|
5
5
|
x-ignore
|
|
6
6
|
>
|
|
7
|
-
<input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
7
|
+
<input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white placeholder:select-none text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
8
8
|
:class="{'border-form-highlight dark:form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
|
|
9
9
|
x-model="input{{getRandom}}"
|
|
10
10
|
id="input{{getRandom}}"
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
{{/if}}
|
|
10
10
|
</div>
|
|
11
11
|
{{#unless _success}}
|
|
12
|
-
{{#> components/button/button _variant="primary"_size="lg"
|
|
12
|
+
{{#> components/button/button _variant="primary"_size="lg" }}
|
|
13
13
|
<span class="text-base ds-button-label ">Nochmal versuchen</span>
|
|
14
14
|
{{/components/button/button}}
|
|
15
|
+
{{#*inline "htmlProperties"}}
|
|
16
|
+
@click="retryHandler"
|
|
17
|
+
{{/inline}}
|
|
15
18
|
{{/unless}}
|
|
16
19
|
</div>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<div class="w-full h-4 bg-white dark:bg-black dark:text-text-dark"></div>
|
|
8
8
|
<textarea
|
|
9
|
-
class="relative w-full pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9
|
|
9
|
+
class="relative w-full py-px pl-4 placeholder-transparent bg-white placeholder:select-none dark:border-form-highlight-dark min-h-12 peer focus:border-b-2 focus:py-0 text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
10
10
|
x-model="textarea{{getRandom}}"
|
|
11
11
|
id="textarea{{getRandom}}"
|
|
12
12
|
{{#if _required}}
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
maxlength="{{_maxLength}}"
|
|
36
36
|
{{/if~}}
|
|
37
37
|
{{#if _required}}required{{/if}}
|
|
38
|
-
class="relative w-full px-4 pb-px text-black placeholder-transparent bg-white border-form-highlight dark:border-form-highlight-dark min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
|
|
39
38
|
{{#if _required}}
|
|
40
39
|
:class="{'border-form-highlight dark:border-form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
|
|
41
40
|
{{/if}}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{{~#if _newWebForm ~}}
|
|
2
|
-
{{#>components/forms/components/backgroundBox }}
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
{{#>components/forms/components/backgroundBox }}
|
|
5
3
|
<h3 class="mb-6 text-2xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
6
4
|
{{this.title}}
|
|
7
5
|
</h3>
|
|
@@ -21,20 +19,39 @@
|
|
|
21
19
|
enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}"
|
|
22
20
|
accept-charset="utf-8"
|
|
23
21
|
|
|
22
|
+
>
|
|
23
|
+
<div x-show="!wasPosted"
|
|
24
|
+
x-transition:enter="transition ease-out duration-300 delay-300"
|
|
25
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
26
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
27
|
+
x-transition:leave="transition ease-in duration-75 delay-0"
|
|
28
|
+
x-transition:leave-start="opacity-100 transform scale-100"
|
|
29
|
+
x-transition:leave-end="opacity-0 transform scale-90"
|
|
24
30
|
>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{{> components/forms/components/controls }}
|
|
31
|
+
{{> components/forms/components/fields _formId=(joinStrings 'form' (getRandom)) }}
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
{{> components/forms/components/controls }}
|
|
34
|
+
</div>
|
|
35
|
+
<div id="successMessage" x-show="wasPostedWithSuccess"
|
|
36
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
37
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
38
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
39
|
+
x-cloak
|
|
40
|
+
>
|
|
30
41
|
{{> components/forms/components/message _success=true }}
|
|
31
|
-
</
|
|
42
|
+
</div>
|
|
32
43
|
|
|
33
|
-
<
|
|
44
|
+
<div id="errorMessage" x-show="wasPostedWithError"
|
|
45
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
46
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
47
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
48
|
+
x-cloak>
|
|
34
49
|
{{> components/forms/components/message _success=false }}
|
|
35
|
-
</
|
|
36
|
-
|
|
50
|
+
</div>
|
|
51
|
+
|
|
37
52
|
</form>
|
|
53
|
+
|
|
54
|
+
|
|
38
55
|
</div>
|
|
39
56
|
{{/components/forms/components/backgroundBox }}
|
|
40
57
|
{{~else~}}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"repository": "https://github.com/szuelch/hr-design-system-handlebars",
|
|
9
|
-
"version": "1.113.
|
|
9
|
+
"version": "1.113.2",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"storybook": "storybook dev -p 6006 public",
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
"hasNewWebForm": true,
|
|
11
11
|
"title": "Kontaktformular",
|
|
12
12
|
"jsonUrl": "https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de",
|
|
13
|
-
"errorMessages":
|
|
13
|
+
"errorMessages":
|
|
14
|
+
{
|
|
15
|
+
"@->jsoninclude": "forms/error_messages.inc.json",
|
|
16
|
+
"@->contentpath": "error-messages"
|
|
17
|
+
|
|
18
|
+
},
|
|
14
19
|
"isMultipart": "isMultipart",
|
|
15
20
|
"trackingInformations": "trackingInformations",
|
|
16
21
|
"fields":[
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"copytextParagraph": [
|
|
3
|
+
{
|
|
4
|
+
"isHeadline": true,
|
|
5
|
+
"text": "Copytext mit Formular"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"paragraphBoxItem": {
|
|
9
|
+
"isWebForm": true,
|
|
10
|
+
"hasNewWebForm": true,
|
|
11
|
+
"title": "Kontaktformular",
|
|
12
|
+
"jsonUrl": "https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de",
|
|
13
|
+
"errorMessages":
|
|
14
|
+
{
|
|
15
|
+
"@->jsoninclude": "forms/error_messages.inc.json",
|
|
16
|
+
"@->contentpath": "error-messages"
|
|
17
|
+
|
|
18
|
+
},
|
|
19
|
+
"isMultipart": "isMultipart",
|
|
20
|
+
"trackingInformations": "trackingInformations",
|
|
21
|
+
"fields":[
|
|
22
|
+
{
|
|
23
|
+
"@->jsoninclude": "forms/form_fields.inc.json",
|
|
24
|
+
"@->contentpath": "input-text-vorname"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{
|
|
2
|
+
"error-messages": ""form_error_required":"Server: Pflichtfeld","form_error_max":"Server: Zu viele Zeichen","form_error_validurl":"Server: Ungültige URL","form_error_empty":"Server: Darf nicht ausgefüllt werden","form_error_constants_or_null":"Server: Ungültiger Wert","form_error_constants":"Server: Ungültiger Wert","form_error_max_multivalue":"Server: Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten","vote_error_identity_already_used":"Server: Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.","vote_error_token_request_count_exceeded":"Server: Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.","form_error_email":"Server: Ungültige E-Mail-Adresse""
|
|
3
|
+
}
|
package/src/assets/js/alpine.js
CHANGED
|
@@ -54,7 +54,8 @@ Alpine.store('sharingBottomPos', {
|
|
|
54
54
|
})
|
|
55
55
|
Alpine.store('forms', {
|
|
56
56
|
submissionAttempted: [],
|
|
57
|
-
serverErrorFields: [{}]
|
|
57
|
+
serverErrorFields: [{}],
|
|
58
|
+
errorMessages: [{}]
|
|
58
59
|
})
|
|
59
60
|
// Initialization of data handlers
|
|
60
61
|
Alpine.data('mainNavigationHandler', mainNavigationHandler)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import copytext from './copytext.hbs'
|
|
2
2
|
|
|
3
3
|
import copytext_webform_json from './fixtures/copytext_webform.json'
|
|
4
|
+
import copytext_webform_simple_json from './fixtures/copytext_webform_simple.json'
|
|
4
5
|
|
|
5
6
|
const Template = ({ ...args }) => {
|
|
6
7
|
return copytext({ ...args })
|
|
@@ -40,4 +41,54 @@ export const WithWebform = {
|
|
|
40
41
|
name: 'Formular',
|
|
41
42
|
args: copytext_webform_json,
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
export const WithWebformStatusOk = {
|
|
45
|
+
render: Template.bind({}),
|
|
46
|
+
name: 'Formular Status OK',
|
|
47
|
+
args: copytext_webform_simple_json,
|
|
48
|
+
parameters: {
|
|
49
|
+
mockData: [
|
|
50
|
+
{
|
|
51
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
|
|
52
|
+
method: 'POST',
|
|
53
|
+
status: 200,
|
|
54
|
+
response: {
|
|
55
|
+
"status":"OK"
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export const WithWebformStatusNone = {
|
|
62
|
+
render: Template.bind({}),
|
|
63
|
+
name: 'Formular Status None',
|
|
64
|
+
args: copytext_webform_simple_json,
|
|
65
|
+
parameters: {
|
|
66
|
+
mockData: [
|
|
67
|
+
{
|
|
68
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
|
|
69
|
+
method: 'POST',
|
|
70
|
+
status: 200,
|
|
71
|
+
response: {
|
|
72
|
+
"status":""
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export const WithWebformStatusValidationError = {
|
|
79
|
+
render: Template.bind({}),
|
|
80
|
+
name: 'Formular Status Validation Error',
|
|
81
|
+
args: copytext_webform_simple_json,
|
|
82
|
+
parameters: {
|
|
83
|
+
mockData: [
|
|
84
|
+
{
|
|
85
|
+
url: 'https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de',
|
|
86
|
+
method: 'POST',
|
|
87
|
+
status: 200,
|
|
88
|
+
response: {
|
|
89
|
+
"status":"VALIDATION_ERROR", "errors":{"vorname":"form_error_required"}
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"copytextParagraph":[{"isHeadline":true,"text":"Copytext mit Formular"},{"paragraphBoxItem":{"isWebForm":true,"hasNewWebForm":true,"title":"Kontaktformular","jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":"
|
|
1
|
+
{"copytextParagraph":[{"isHeadline":true,"text":"Copytext mit Formular"},{"paragraphBoxItem":{"isWebForm":true,"hasNewWebForm":true,"title":"Kontaktformular","jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":""form_error_required":"Server: Pflichtfeld","form_error_max":"Server: Zu viele Zeichen","form_error_validurl":"Server: Ungültige URL","form_error_empty":"Server: Darf nicht ausgefüllt werden","form_error_constants_or_null":"Server: Ungültiger Wert","form_error_constants":"Server: Ungültiger Wert","form_error_max_multivalue":"Server: Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten","vote_error_identity_already_used":"Server: Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.","vote_error_token_request_count_exceeded":"Server: Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.","form_error_email":"Server: Ungültige E-Mail-Adresse"","isMultipart":"isMultipart","trackingInformations":"trackingInformations","fields":[{"type":{"isText":true,"asString":"text"},"name":"vorname","label":"Vorname","description":"Das ist der Beschreibungstext (*Pflichtfeld)","defaultValue":"","isHidden":false,"isRequired":true,"maxLength":"140"},{"type":{"isText":true,"asString":"text"},"name":"nachname","label":"Nachname","description":"","defaultValue":"","isHidden":false,"isRequired":true,"maxLength":"140"},{"type":{"isUpload":true,"asString":"upload"},"name":"Datei Hochladen","label":"Wählen Sie eine Datei zum Hochladen","description":"Maximale Dateigröße: 35 MB.","isRequired":true},{"type":{"isSelect":true,"asString":"select"},"name":"Select Name","label":"Wen möchten Sie erreichen?","description":"Das ist der Beschreibungstext von Select","defaultValue":"","isHidden":false,"isRequired":true,"options":[{"id":"option1","value":"option1","selected":false,"label":"Option 1"},{"id":"option2","value":"option2","selected":false,"label":"Option 2"},{"id":"option3","value":"option3","selected":false,"label":"Option 3"},{"id":"option4","value":"option4","selected":false,"label":"Option 4"}]},{"isGrouped":true,"type":{"isChoice":true,"asString":"checkbox"},"name":"interessen","label":"Wählen Sie Ihre Interessen","isMeta":false,"description":"Bitte kreuzen Sie alle Interessen an, die auf Sie zutreffen. Ihre Auswahl hilft uns, Ihnen relevante Inhalte anzubieten.","isRequired":false,"options":[{"value":"sport","label":"sport","title":"sport","isSelected":false},{"value":"musik","label":"musik","title":"musik","isSelected":false},{"value":"lesen","label":"lesen","title":"lesen","isSelected":false},{"value":"reisen","label":"reisen","title":"reisen","isSelected":false},{"value":"kochen","label":"kochen","title":"kochen","isSelected":false},{"value":"filme","label":"filme","title":"filme","isSelected":false},{"value":"tanzen","label":"tanzen","title":"tanzen","isSelected":false},{"value":"fotografie","label":"fotografie","title":"fotografie","isSelected":false}]},{"isGrouped":true,"type":{"isChoice":true,"isRadioChoice":true,"asString":"radio"},"name":"lieblingsfarbe","label":"Wählen Sie Ihre Lieblingsfarbe","isMeta":false,"description":"Bitte wählen Sie eine der folgenden Farben aus.","isRequired":true,"options":[{"value":"rot","label":"rot","title":"rot","isSelected":false},{"value":"blau","label":"blau","title":"blau","isSelected":false},{"value":"grün","label":"grün","title":"grün","isSelected":false}]},{"isGrouped":true,"type":{"isChoice":true,"isRadioChoice":true,"asString":"radio"},"name":"lieblingsfarbe","label":"Wählen Sie Ihre Lieblingsfarbe","isMeta":false,"description":"Bitte wählen Sie eine der folgenden Farben aus.","isRequired":false,"options":[{"value":"rot","label":"rot","title":"rot","isSelected":false},{"value":"blau","label":"blau","title":"blau","isSelected":false},{"value":"grün","label":"grün","title":"grün","isSelected":false}]},{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":false},{"isGrouped":false,"type":{"isChoice":true,"asString":"checkbox"},"name":"checkbox","label":"Ich bin damit einverstanden, dass der hr die von mir im vorstehenden Formular angegebenen personenbezogenen Daten für den Zweck der Kontaktaufnahme mit Upload verarbeitet. Eine Weitergabe an Dritte findet nicht statt, es sei denn, es wird ausdrücklich darauf hingewiesen. Unsere Datenschutzerklärung mit sämtlichen Informationen gemäß Art 13 DSGVO zur Datenverarbeitung durch den hr und zu Ihren Rechten können Sie unter Datenschutzerklärung einsehen. Den Datenschutzbeauftragten des hr erreichen Sie unter datenschutz@hr.de.","isMeta":false,"description":"Das ist der Beschreibungstext von Checkbox","isRequired":true}]}}]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"copytextParagraph":[{"isHeadline":true,"text":"Copytext mit Formular"},{"paragraphBoxItem":{"isWebForm":true,"hasNewWebForm":true,"title":"Kontaktformular","jsonUrl":"https://ugc-hessenschau.dev-ext.hrcms.gcp.cloud.hr.de","errorMessages":""form_error_required":"Server: Pflichtfeld","form_error_max":"Server: Zu viele Zeichen","form_error_validurl":"Server: Ungültige URL","form_error_empty":"Server: Darf nicht ausgefüllt werden","form_error_constants_or_null":"Server: Ungültiger Wert","form_error_constants":"Server: Ungültiger Wert","form_error_max_multivalue":"Server: Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten","vote_error_identity_already_used":"Server: Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich.","vote_error_token_request_count_exceeded":"Server: Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt.","form_error_email":"Server: Ungültige E-Mail-Adresse"","isMultipart":"isMultipart","trackingInformations":"trackingInformations","fields":[{"type":{"isText":true,"asString":"text"},"name":"vorname","label":"Vorname","description":"Das ist der Beschreibungstext von Vorname","defaultValue":"","isHidden":false,"isRequired":false}]}}]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<label class="order-2 cursor-pointer {{> components/button/utilities/button_base_classes}} {{> components/button/utilities/button_variation_classes _variant='primary'}} {{> components/button/utilities/button_dimension_classes _size='lg'}}">
|
|
5
5
|
<span class="hidden" :class="{'hidden': !isPosting}">{{> components/base/image/icon _icon="reload" _addClass="w-5 h-5 fill-white dark:fill-text-dark animate-spin"}}</span>
|
|
6
6
|
<span class="" :class="{'hidden': isPosting}">{{> components/base/image/icon _icon="send-ds" _addClass="w-5 h-5 fill-white dark:fill-text-dark "}}</span>
|
|
7
|
-
<input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="
|
|
7
|
+
<input type="submit" class="pl-2 cursor-pointer" value="Absenden" @click.prevent="submitButtonHandler($event)"/>
|
|
8
8
|
</label>
|
|
9
9
|
|
|
10
10
|
{{#> components/button/button _variant="tertiary"_size="lg" _css="order-1 mr-4" _type="reset"}}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
x-init="validateField()"
|
|
5
5
|
x-ignore
|
|
6
6
|
>
|
|
7
|
-
<input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
7
|
+
<input class="relative w-full h-12 pt-4 pl-4 placeholder-transparent bg-white placeholder:select-none text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 peer border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
8
8
|
:class="{'border-form-highlight dark:form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
|
|
9
9
|
x-model="input{{getRandom}}"
|
|
10
10
|
id="input{{getRandom}}"
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
{{/if}}
|
|
10
10
|
</div>
|
|
11
11
|
{{#unless _success}}
|
|
12
|
-
{{#> components/button/button _variant="primary"_size="lg"
|
|
12
|
+
{{#> components/button/button _variant="primary"_size="lg" }}
|
|
13
13
|
<span class="text-base ds-button-label ">Nochmal versuchen</span>
|
|
14
14
|
{{/components/button/button}}
|
|
15
|
+
{{#*inline "htmlProperties"}}
|
|
16
|
+
@click="retryHandler"
|
|
17
|
+
{{/inline}}
|
|
15
18
|
{{/unless}}
|
|
16
19
|
</div>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<div class="w-full h-4 bg-white dark:bg-black dark:text-text-dark"></div>
|
|
8
8
|
<textarea
|
|
9
|
-
class="relative w-full pl-4 placeholder-transparent bg-white text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9
|
|
9
|
+
class="relative w-full py-px pl-4 placeholder-transparent bg-white placeholder:select-none dark:border-form-highlight-dark min-h-12 peer focus:border-b-2 focus:py-0 text-text dark:bg-black dark:text-text-dark autofill:shadow-autofill border-form-highlight dark:form-highlight-dark pr-9 border-y focus:border-y-2 border-t-transparent dark:border-t-transparent focus:outline-none"
|
|
10
10
|
x-model="textarea{{getRandom}}"
|
|
11
11
|
id="textarea{{getRandom}}"
|
|
12
12
|
{{#if _required}}
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
maxlength="{{_maxLength}}"
|
|
36
36
|
{{/if~}}
|
|
37
37
|
{{#if _required}}required{{/if}}
|
|
38
|
-
class="relative w-full px-4 pb-px text-black placeholder-transparent bg-white border-form-highlight dark:border-form-highlight-dark min-h-12 peer border-y focus:border-b-2 focus:pb-0 border-t-transparent focus:outline-none"
|
|
39
38
|
{{#if _required}}
|
|
40
39
|
:class="{'border-form-highlight dark:border-form-highlight-dark': hideError(),'border-error dark:border-error-dark': hideDescription() }"
|
|
41
40
|
{{/if}}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
2
|
+
|
|
1
3
|
export default function contactForm(formId, jsonUrl, errorMessages, multipart, trackingInformations, jsonp = false) {
|
|
2
4
|
return {
|
|
3
5
|
isPosting: false,
|
|
4
|
-
|
|
6
|
+
wasPosted: false,
|
|
7
|
+
wasPostedWithSuccess: false,
|
|
8
|
+
wasPostedWithError: false,
|
|
9
|
+
isWebview: window.parent.document.documentElement.classList.contains('webview'),
|
|
5
10
|
ajaxTimeout: 60 * 1000,
|
|
6
11
|
form: this.$refs[formId],
|
|
7
12
|
formWrapper: this.$refs[formId].closest("#formWrapper"),
|
|
@@ -13,47 +18,20 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
13
18
|
},
|
|
14
19
|
formInit(){
|
|
15
20
|
this.checkForJsonURL()
|
|
16
|
-
console.log("%cformId:", 'color: green' ,formId);
|
|
17
|
-
console.log("%cform:", 'color: green' ,this.form);
|
|
18
|
-
console.log("%cformWrapper:", 'color: green' ,this.formWrapper);
|
|
19
|
-
console.log("%cactionUrl:", 'color: green' ,this.actionUrl);
|
|
20
|
-
console.log("%cjsonUrl:", 'color: green', jsonUrl);
|
|
21
|
-
console.log("%cerrorMessages:", 'color: green', errorMessages);
|
|
22
|
-
console.log("%cmultipart:", 'color: green', multipart);
|
|
23
|
-
console.log("%ctrackingInformations:", 'color: green', trackingInformations);
|
|
24
|
-
|
|
25
21
|
this.$store.forms.submissionAttempted[formId] = false;
|
|
22
|
+
this.$store.forms.errorMessages = JSON.parse( "{" + errorMessages.replace(/"/g,'"') + "}")
|
|
26
23
|
},
|
|
27
|
-
|
|
28
|
-
console.log("event:",event);
|
|
29
|
-
console.log('check for Error:',formId);
|
|
30
|
-
console.log('form:',this.form);
|
|
31
|
-
|
|
24
|
+
submitButtonHandler(event) {
|
|
32
25
|
if(this.form.reportValidity()){
|
|
33
|
-
// this.logData(event,form);
|
|
34
26
|
this.handleSubmit(event,this.form)
|
|
35
27
|
} else {
|
|
36
28
|
this.$store.forms.submissionAttempted[formId] = true;
|
|
37
29
|
}
|
|
38
30
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const fields = Array.from(form.elements);
|
|
43
|
-
// Log the serialized form data
|
|
44
|
-
console.log(fields);
|
|
45
|
-
|
|
46
|
-
// Convert the FormData to a serialized string
|
|
47
|
-
const serializedData = Array.from(formData.entries())
|
|
48
|
-
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
49
|
-
.join('&');
|
|
50
|
-
|
|
51
|
-
// Log the serialized form data
|
|
52
|
-
console.log('serialized DATA: ' + serializedData);
|
|
53
|
-
console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
|
|
54
|
-
|
|
31
|
+
retryHandler() {
|
|
32
|
+
this.wasPosted = false;
|
|
33
|
+
this.wasPostedWithError = false;
|
|
55
34
|
},
|
|
56
|
-
// TODO - Validation error handler (adapt to your case)
|
|
57
35
|
handleValidationErrors(errors) {
|
|
58
36
|
console.log('Validation Errors:', errors);
|
|
59
37
|
this.$store.forms.serverErrorFields[formId] = errors;
|
|
@@ -61,29 +39,19 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
61
39
|
},
|
|
62
40
|
resetValidationErrors() {
|
|
63
41
|
this.$store.forms.serverErrorFields[formId] = {}
|
|
64
|
-
},
|
|
65
|
-
|
|
42
|
+
},
|
|
66
43
|
handleSubmit(event, form ) {
|
|
67
44
|
event.preventDefault();
|
|
68
45
|
|
|
69
|
-
if (!this.isWebview) {
|
|
70
|
-
|
|
46
|
+
if (!this.isWebview) {
|
|
47
|
+
uxAction(trackingInformations);
|
|
71
48
|
}
|
|
72
49
|
|
|
73
50
|
if (this.isPosting) return;
|
|
74
51
|
this.isPosting = true;
|
|
75
52
|
|
|
76
|
-
// TODO mit alpine umsetzen
|
|
77
|
-
//const preloadIcon = formWrapper.querySelector('.js-preloadIcon');
|
|
78
|
-
//const loadingIcon = formWrapper.querySelector('.js-loadingIcon');
|
|
79
|
-
|
|
80
|
-
// Show loading indicator
|
|
81
|
-
//preloadIcon.classList.add('-isHidden');
|
|
82
|
-
//loadingIcon.classList.remove('-isHidden');
|
|
83
|
-
|
|
84
53
|
console.log('DATA:', new URLSearchParams(new FormData(form)).toString());
|
|
85
54
|
|
|
86
|
-
// Define ajaxOptions based on form type (without jQuery $.ajax)
|
|
87
55
|
let ajaxOptions = {
|
|
88
56
|
method: jsonp ? 'GET' : 'POST',
|
|
89
57
|
headers: {
|
|
@@ -96,13 +64,13 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
96
64
|
if (jsonp) {
|
|
97
65
|
ajaxOptions.url = this.actionUrl;
|
|
98
66
|
ajaxOptions.headers['Content-Type'] = 'application/json; charset=utf-8';
|
|
99
|
-
ajaxOptions.body = new URLSearchParams(new FormData(form)).toString();
|
|
67
|
+
ajaxOptions.body = new URLSearchParams(new FormData(form)).toString();
|
|
100
68
|
} else if (multipart) {
|
|
101
69
|
ajaxOptions = {
|
|
102
70
|
method: 'POST',
|
|
103
71
|
url: this.actionUrl,
|
|
104
72
|
timeout: 600 * 1000,
|
|
105
|
-
body: new FormData(form),
|
|
73
|
+
body: new FormData(form),
|
|
106
74
|
processData: false,
|
|
107
75
|
headers: {}
|
|
108
76
|
};
|
|
@@ -110,10 +78,9 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
110
78
|
ajaxOptions.url = `${this.actionUrl}?${responseFormatParam}`;
|
|
111
79
|
}
|
|
112
80
|
|
|
113
|
-
// Using fetch API instead of $.ajax
|
|
114
81
|
fetch(ajaxOptions.url, ajaxOptions)
|
|
115
82
|
.then(async (response) => {
|
|
116
|
-
const data = await response.text();
|
|
83
|
+
const data = await response.text();
|
|
117
84
|
if (response.ok) {
|
|
118
85
|
console.log('Done');
|
|
119
86
|
console.log(data);
|
|
@@ -126,74 +93,42 @@ export default function contactForm(formId, jsonUrl, errorMessages, multipart, t
|
|
|
126
93
|
break;
|
|
127
94
|
case 'OK':
|
|
128
95
|
console.log("OK");
|
|
129
|
-
this.
|
|
130
|
-
|
|
131
|
-
this.form.querySelector('#successMessage').innerHTML,
|
|
132
|
-
true
|
|
133
|
-
);
|
|
96
|
+
this.wasPosted = true;
|
|
97
|
+
this.wasPostedWithSuccess = true;
|
|
134
98
|
break;
|
|
135
99
|
default:
|
|
136
100
|
console.log("default");
|
|
137
|
-
this.
|
|
138
|
-
|
|
139
|
-
this.form.querySelector('#errorMessage').innerHTML,
|
|
140
|
-
true
|
|
141
|
-
);
|
|
101
|
+
this.wasPosted = true;
|
|
102
|
+
this.wasPostedWithError = true;
|
|
142
103
|
break;
|
|
143
104
|
}
|
|
144
105
|
} else {
|
|
145
|
-
|
|
106
|
+
|
|
107
|
+
this.wasPosted = true;
|
|
108
|
+
this.wasPostedWithError = true;
|
|
146
109
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} */
|
|
151
|
-
|
|
152
|
-
/* if (rootElement.id) {
|
|
153
|
-
window.location.hash = rootElement.id;
|
|
154
|
-
} */
|
|
110
|
+
if (formId) {
|
|
111
|
+
window.location.hash = formId;
|
|
112
|
+
}
|
|
155
113
|
} else {
|
|
114
|
+
this.wasPosted = true;
|
|
115
|
+
this.wasPostedWithError = true;
|
|
156
116
|
throw new Error('Network response was not ok.');
|
|
117
|
+
|
|
157
118
|
}
|
|
158
119
|
})
|
|
159
120
|
.catch((error) => {
|
|
160
121
|
console.error('Fail:', error);
|
|
161
|
-
this.
|
|
162
|
-
|
|
163
|
-
'<div class="c-form success">Das hat leider nicht funktioniert!</div>',
|
|
164
|
-
true
|
|
165
|
-
);
|
|
122
|
+
this.wasPosted = true;
|
|
123
|
+
this.wasPostedWithError = true;
|
|
166
124
|
})
|
|
167
125
|
.finally(() => {
|
|
168
126
|
console.log('Always');
|
|
169
|
-
// TODO MIT ALPINE UMSETZEN
|
|
170
|
-
//preloadIcon.classList.remove('-isHidden');
|
|
171
|
-
//loadingIcon.classList.add('-isHidden');
|
|
172
127
|
this.isPosting = false;
|
|
173
128
|
});
|
|
174
129
|
},
|
|
175
|
-
// Helper function to replace content with animation (replacing hrQuery's replaceAnimated)
|
|
176
|
-
replaceAnimated(wrapper, newContent, withFade = true) {
|
|
177
|
-
if (withFade) {
|
|
178
|
-
wrapper.style.opacity = 0;
|
|
179
|
-
setTimeout(() => {
|
|
180
|
-
wrapper.innerHTML = newContent;
|
|
181
|
-
wrapper.style.opacity = 1;
|
|
182
|
-
}, 300);
|
|
183
|
-
} else {
|
|
184
|
-
wrapper.innerHTML = newContent;
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
// Fire event utility (could be Alpine.js specific or custom)
|
|
188
|
-
fireEvent(eventName, success){
|
|
189
|
-
const event = new CustomEvent(eventName, { detail: success });
|
|
190
|
-
document.dispatchEvent(event);
|
|
191
|
-
},
|
|
192
130
|
getSubmissionAttempted() {
|
|
193
131
|
return this.$store.forms.submissionAttempted[formId]
|
|
194
|
-
}
|
|
195
|
-
|
|
132
|
+
}
|
|
196
133
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
134
|
+
}
|
|
@@ -90,42 +90,8 @@ export default function inputHandler(element, formId, errorMandatory, type, erro
|
|
|
90
90
|
return Boolean(this.$store.forms.serverErrorFields[formId]?.[name]);
|
|
91
91
|
},
|
|
92
92
|
getServerError() {
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
case 'form_error_required':
|
|
97
|
-
serverError += "Pflichtfeld"
|
|
98
|
-
break
|
|
99
|
-
case 'form_error_max':
|
|
100
|
-
serverError += "Zu viele Zeichen"
|
|
101
|
-
break
|
|
102
|
-
case 'form_error_validurl':
|
|
103
|
-
serverError += "Ungültige URL"
|
|
104
|
-
break
|
|
105
|
-
case 'form_error_empty':
|
|
106
|
-
serverError += "Darf nicht ausgefüllt werden"
|
|
107
|
-
break
|
|
108
|
-
case 'form_error_constants_or_null':
|
|
109
|
-
serverError += "Ungültiger Wert"
|
|
110
|
-
break
|
|
111
|
-
case 'form_error_constants':
|
|
112
|
-
serverError += "Ungültiger Wert"
|
|
113
|
-
break
|
|
114
|
-
case 'form_error_max_multivalue':
|
|
115
|
-
serverError += "Die maximale Anzahl an Antwortmöglichkeiten wurde überschritten"
|
|
116
|
-
break
|
|
117
|
-
case 'vote_error_identity_already_used':
|
|
118
|
-
serverError += "Unter dieser E-Mail-Adresse wurde bereits abgestimmt. Eine weitere Abstimmung ist nicht möglich."
|
|
119
|
-
break
|
|
120
|
-
case 'vote_error_token_request_count_exceeded':
|
|
121
|
-
serverError += "Die maximale Anzahl an Bestätigungs-E-Mails wurde bereits verschickt."
|
|
122
|
-
break
|
|
123
|
-
case 'form_error_email':
|
|
124
|
-
serverError += "Ungültige E-Mail-Adresse"
|
|
125
|
-
break
|
|
126
|
-
default:
|
|
127
|
-
return false
|
|
128
|
-
}
|
|
93
|
+
let errorName = this.$store.forms.serverErrorFields[formId][name]
|
|
94
|
+
let serverError = this.$store.forms.errorMessages[errorName]
|
|
129
95
|
return serverError
|
|
130
96
|
}
|
|
131
97
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{{~#if _newWebForm ~}}
|
|
2
|
-
{{#>components/forms/components/backgroundBox }}
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
{{#>components/forms/components/backgroundBox }}
|
|
5
3
|
<h3 class="mb-6 text-2xl font-headingSerif sm:mb-12 text-text dark:text-text-dark">
|
|
6
4
|
{{this.title}}
|
|
7
5
|
</h3>
|
|
@@ -21,20 +19,39 @@
|
|
|
21
19
|
enctype="{{if this.isMultipart 'multipart/form-data' 'application/x-www-form-urlencoded'}}"
|
|
22
20
|
accept-charset="utf-8"
|
|
23
21
|
|
|
22
|
+
>
|
|
23
|
+
<div x-show="!wasPosted"
|
|
24
|
+
x-transition:enter="transition ease-out duration-300 delay-300"
|
|
25
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
26
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
27
|
+
x-transition:leave="transition ease-in duration-75 delay-0"
|
|
28
|
+
x-transition:leave-start="opacity-100 transform scale-100"
|
|
29
|
+
x-transition:leave-end="opacity-0 transform scale-90"
|
|
24
30
|
>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{{> components/forms/components/controls }}
|
|
31
|
+
{{> components/forms/components/fields _formId=(joinStrings 'form' (getRandom)) }}
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
{{> components/forms/components/controls }}
|
|
34
|
+
</div>
|
|
35
|
+
<div id="successMessage" x-show="wasPostedWithSuccess"
|
|
36
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
37
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
38
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
39
|
+
x-cloak
|
|
40
|
+
>
|
|
30
41
|
{{> components/forms/components/message _success=true }}
|
|
31
|
-
</
|
|
42
|
+
</div>
|
|
32
43
|
|
|
33
|
-
<
|
|
44
|
+
<div id="errorMessage" x-show="wasPostedWithError"
|
|
45
|
+
x-transition:enter="transition ease-out duration-300 delay-75"
|
|
46
|
+
x-transition:enter-start="opacity-0 transform scale-90"
|
|
47
|
+
x-transition:enter-end="opacity-100 transform scale-100"
|
|
48
|
+
x-cloak>
|
|
34
49
|
{{> components/forms/components/message _success=false }}
|
|
35
|
-
</
|
|
36
|
-
|
|
50
|
+
</div>
|
|
51
|
+
|
|
37
52
|
</form>
|
|
53
|
+
|
|
54
|
+
|
|
38
55
|
</div>
|
|
39
56
|
{{/components/forms/components/backgroundBox }}
|
|
40
57
|
{{~else~}}
|