|
130 | 130 | :style="{ color: $themeTokens.error }" |
131 | 131 | class="field-error" |
132 | 132 | > |
133 | | - {{ $tr('fieldRequired') }} |
| 133 | + {{ fieldRequiredText }} |
134 | 134 | </div> |
135 | 135 |
|
136 | 136 | <!-- Location --> |
|
144 | 144 | :style="{ color: $themeTokens.error }" |
145 | 145 | class="field-error" |
146 | 146 | > |
147 | | - {{ $tr('fieldRequired') }} |
| 147 | + {{ fieldRequiredText }} |
148 | 148 | </div> |
149 | 149 |
|
150 | 150 | <!-- Source --> |
|
182 | 182 | :style="{ color: $themeTokens.error }" |
183 | 183 | class="field-error" |
184 | 184 | > |
185 | | - {{ $tr('fieldRequired') }} |
| 185 | + {{ fieldRequiredText }} |
186 | 186 | </div> |
187 | 187 |
|
188 | 188 | <!-- Agreements --> |
|
243 | 243 | <script> |
244 | 244 |
|
245 | 245 | import { mapActions, mapGetters, mapState } from 'vuex'; |
246 | | - import KTextbox from 'kolibri-design-system/lib/KTextbox'; |
247 | | - import KCheckbox from 'kolibri-design-system/lib/KCheckbox'; |
248 | | - import KTransition from 'kolibri-design-system/lib/KTransition'; |
249 | | - import KSelect from 'kolibri-design-system/lib/KSelect'; |
250 | | - import KRouterLink from 'kolibri-design-system/lib/buttons-and-links/KRouterLink'; |
251 | 246 | import { uses, sources } from '../constants'; |
252 | 247 | import StudioEmailField from '../components/form/StudioEmailField'; |
253 | 248 | import StudioPasswordField from '../components/form/StudioPasswordField'; |
|
262 | 257 | name: 'Create', |
263 | 258 | components: { |
264 | 259 | StudioImmersiveModal, |
265 | | - KTextbox, |
266 | | - KCheckbox, |
267 | | - KTransition, |
268 | | - KSelect, |
269 | 260 | StudioEmailField, |
270 | 261 | StudioPasswordField, |
271 | 262 | CountryField, |
272 | 263 | PolicyModals, |
273 | 264 | StudioBanner, |
274 | | - KRouterLink, |
275 | 265 | }, |
276 | 266 | data() { |
277 | 267 | return { |
|
288 | 278 | storage: '', |
289 | 279 | other_use: '', |
290 | 280 | locations: [], |
291 | | - source: {}, |
| 281 | + source: { value: '', label: '' }, |
292 | 282 | organization: '', |
293 | 283 | conference: '', |
294 | 284 | other_source: '', |
|
362 | 352 | policies() { |
363 | 353 | return policies; |
364 | 354 | }, |
| 355 | + fieldRequiredText() { |
| 356 | + /* eslint-disable-next-line kolibri/vue-no-undefined-string-uses */ |
| 357 | + return commonStrings.$tr('fieldRequired'); |
| 358 | + }, |
365 | 359 | sourceOptions() { |
366 | 360 | return [ |
367 | 361 | { |
|
480 | 474 | showOtherField(id) { |
481 | 475 | return id === uses.OTHER && this.form.uses.includes(id); |
482 | 476 | }, |
| 477 | + // Custom validation is used (not generateFormMixin) because KTextbox requires |
| 478 | + // field-specific error message strings via :invalidText, which generateFormMixin |
| 479 | + // does not support (it stores only boolean errors per field). |
483 | 480 | validateField(field) { |
484 | 481 | switch (field) { |
485 | 482 | case 'first_name': |
|
567 | 564 | return isValid; |
568 | 565 | }, |
569 | 566 | submit() { |
570 | | - // We need to check the "acceptedAgreement" here explicitly because it is not a |
571 | | - // Vuetify form field and does not trigger the form validation. |
| 567 | + // acceptedAgreement must be checked explicitly here as it is not included in validateForm(). |
572 | 568 | if (this.validateForm() && this.acceptedAgreement) { |
573 | 569 | // Prevent double submission |
574 | 570 | if (this.submitting) { |
|
677 | 673 | otherSourcePlaceholder: 'Please describe', |
678 | 674 |
|
679 | 675 | // Privacy policy + terms of service |
680 | | - fieldRequired: 'Field is required', |
681 | 676 | viewToSLink: 'View Terms of Service', |
682 | 677 | ToSRequiredMessage: 'Please accept our terms of service and policy', |
683 | 678 |
|
|
718 | 713 | } |
719 | 714 |
|
720 | 715 | .banner { |
| 716 | + width: 100%; |
721 | 717 | margin-bottom: 32px; |
722 | 718 | } |
723 | 719 |
|
|
0 commit comments