PluginProbe
The Innovative Form Builder – IvyForms / 0.2.1
The Innovative Form Builder – IvyForms v0.2.1
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 / TextFormField.vue

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

63 lines 1.4 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__text', 'ivyforms-field__text_' + 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__text-input"
13 type="text"
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 // Any other field properties from your data
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 // Generate unique field ID as a string
59 const fieldID = computed(() => {
60 return `ivyforms-field__text-input_${props.field.formId || ''}_${props.field.fieldIndex || ''}`
61 })
62 </script>
63