PluginProbe
The Innovative Form Builder – IvyForms / 0.3
The Innovative Form Builder – IvyForms v0.3
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / frontend / src / views / public / fields / EmailFormField.vue

EmailFormField.vue in The Innovative Form Builder – IvyForms 0.3, at frontend/src/views/public/fields/EmailFormField.vue

64 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <template>
2 <div :class="['ivyforms-field', 'ivyforms-field__email', 'ivyforms-field__email_' + field.id]">
3 <IvyFormItem
4 :label="field.label"
5 :required="field.required"
6 :error="error"
7 :prop="field.type + '_' + field.fieldIndex"
8 >
9 <IvyTextInput
10 :id="fieldID"
11 v-model="localModelValue"
12 class="ivyforms-field__email-input"
13 type="email"
14 :placeholder="field.placeholder"
15 :disabled="disabled"
16 :required="field.required"
17 />
18 </IvyFormItem>
19 </div>
20 </template>
21
22 <script setup lang="ts">
23 import { computed } from 'vue'
24
25 interface Field {
26 id: number
27 formId: number
28 fieldIndex: number
29 type: string
30 label: string
31 placeholder?: string
32 required?: boolean
33 }
34
35 interface FieldProps {
36 modelValue: string | number | null | undefined
37 field: Field
38 disabled?: boolean
39 error?: string
40 }
41
42 const props = withDefaults(defineProps<FieldProps>(), {
43 modelValue: '',
44 disabled: false,
45 error: '',
46 })
47
48 const emit = defineEmits(['update:modelValue'])
49
50 const localModelValue = computed({
51 get() {
52 return props.modelValue
53 },
54 set(value) {
55 emit('update:modelValue', value)
56 },
57 })
58
59 // Generate unique field ID as a string
60 const fieldID = computed(() => {
61 return `ivyforms-field__email-input_${props.field.formId || ''}_${props.field.fieldIndex || ''}`
62 })
63 </script>
64