Skip to content

Beautiful Open-Source Form Builder

Update CustomFieldValidation component text and enhance FormModeStrat… (#830)

Chirag Chhatrala9e79bb5ac6f8
diff --git a/client/components/open/forms/components/CustomFieldValidation.vue b/client/components/open/forms/components/CustomFieldValidation.vue
index a885f2028..48a95e24e 100644
--- a/client/components/open/forms/components/CustomFieldValidation.vue
+++ b/client/components/open/forms/components/CustomFieldValidation.vue
@@ -7,7 +7,7 @@
Step 1: Set Validation Rules
</h3>
<p class="text-neutral-500 text-xs mb-3">
- Define <span class="font-semibold">conditions that must be met</span> for this field to be valid. If these conditions are not met, the field will be marked as invalid.
+ Add validation rules. The field is <span class="font-semibold">valid if these conditions are met</span>.
</p>
<condition-editor
ref="filter-editor"
@@ -24,7 +24,7 @@
Step 2: Set Error Message
</h3>
<p class="text-neutral-500 text-xs mb-2">
- Enter the message that will be <span class="font-semibold">shown to users when the validation rules above are not met</span>.
+ The error message to show <span class="font-semibold">when validation fails</span>.
</p>
<text-input
name="error_message"
diff --git a/client/lib/forms/FormModeStrategy.js b/client/lib/forms/FormModeStrategy.js
index dc2868b05..6ff38ee49 100644
--- a/client/lib/forms/FormModeStrategy.js
+++ b/client/lib/forms/FormModeStrategy.js
@@ -6,7 +6,8 @@ export const FormMode = {
PREVIEW: 'preview', // Admin preview with no validation
PREFILL: 'prefill', // URL prefill preview with no validation
EDIT: 'edit', // Editing an existing submission
- TEST: 'test' // Test mode with validation but no actual submission
+ TEST: 'test', // Test mode with validation but no actual submission
+ TEMPLATE: 'template' // Template mode with no validation
}
/**
@@ -98,6 +99,15 @@ export function createFormModeStrategy(mode) {
strategy.validation.validateOnNextPage = false
strategy.submission.enablePartialSubmissions = false
break
+
+ case FormMode.TEMPLATE:
+ // Template mode
+ strategy.validation.performActualSubmission = false
+ strategy.validation.validateOnNextPage = false
+ strategy.submission.enablePartialSubmissions = false
+ strategy.display.showBranding = false
+ break
+
}
return strategy
diff --git a/client/pages/templates/[slug].vue b/client/pages/templates/[slug].vue
index d07089262..5e87dbacf 100644
--- a/client/pages/templates/[slug].vue
+++ b/client/pages/templates/[slug].vue
@@ -101,7 +101,7 @@
<OpenCompleteForm
ref="open-complete-form"
:form="form"
- :mode="FormMode.TEST"
+ :mode="FormMode.TEMPLATE"
class="mb-4 p-4 bg-neutral-50 border border-neutral-200 border-dashed rounded-lg"
/>
</div>