Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

feat: hide Clear Form button and add custom Submit button label

claude[bot]a7a25d6c4f4f
diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue
index 0a452c557e..8b7bcc9ced 100644
--- a/packages/nc-gui/components/smartsheet/Form.vue
+++ b/packages/nc-gui/components/smartsheet/Form.vue
@@ -1571,17 +1571,7 @@ const { message: templatedMessage } = useTemplatedMessage(
</Draggable>
<div class="flex justify-between items-center mt-6 !px-8 !lg:px-12">
- <NcButton
- type="secondary"
- size="small"
- :disabled="disableFormSubmit"
- class="nc-form-clear nc-form-focus-element"
- data-testid="nc-form-clear"
- data-title="nc-form-clear"
- @click.stop="clearForm"
- >
- {{ $t('activity.clearForm') }}
- </NcButton>
+ <div></div>
<NcButton
type="primary"
@@ -1593,7 +1583,7 @@ const { message: templatedMessage } = useTemplatedMessage(
data-title="nc-form-submit"
@click.stop="submitForm"
>
- {{ $t('general.submit') }}
+ {{ parseProp(formViewData?.meta)?.submit_button_label || $t('general.submit') }}
</NcButton>
</div>
</a-form>
@@ -2165,6 +2155,71 @@ const { message: templatedMessage } = useTemplatedMessage(
</div>
</div>
+ <!-- Submit Button Customization -->
+ <PaymentUpgradeBadgeProvider :feature="PlanFeatureTypes.FEATURE_FORM_CUSTOM_SUBMIT_LABEL">
+ <template #default="{ click }">
+ <div class="flex flex-col gap-3">
+ <div class="flex items-center justify-between gap-3">
+ <span class="flex items-center gap-3">
+ {{ $t('labels.customizeSubmitButton') }}
+ <LazyPaymentUpgradeBadge
+ :feature="PlanFeatureTypes.FEATURE_FORM_CUSTOM_SUBMIT_LABEL"
+ :content="
+ $t('upgrade.upgradeToCustomizeSubmitButtonSubtitle', {
+ plan: getPlanTitle(PlanTitles.PLUS),
+ })
+ "
+ />
+ </span>
+ <a-switch
+ v-if="isEeUI"
+ v-e="[`a:form-view:custom-submit-label`]"
+ :checked="parseProp(formViewData.meta)?.custom_submit_enabled"
+ size="small"
+ class="nc-form-custom-submit-enabled"
+ data-testid="nc-form-custom-submit-enabled"
+ :disabled="isLocked || !isEditable"
+ @change="(value) => {
+ if (isLocked || !isEditable || click(PlanFeatureTypes.FEATURE_FORM_CUSTOM_SUBMIT_LABEL)) return
+
+ const meta = parseProp(formViewData.meta) || {}
+ meta.custom_submit_enabled = value
+ formViewData.meta = meta
+ updateView()
+ }"
+ />
+ <NcTooltip v-else placement="top">
+ <template #title>
+ <div class="text-center">
+ {{ $t('msg.info.thisFeatureIsOnlyAvailableInEnterpriseEdition') }}
+ </div>
+ </template>
+ <a-switch :checked="false" size="small" :disabled="true" />
+ </NcTooltip>
+ </div>
+
+ <div v-if="parseProp(formViewData.meta)?.custom_submit_enabled" class="flex flex-col gap-2">
+ <div class="text-nc-content-gray text-sm">
+ {{ $t('labels.submitButtonLabel') }}
+ </div>
+ <a-input
+ :value="parseProp(formViewData.meta)?.submit_button_label || $t('general.submit')"
+ class="!h-8 !px-3 !py-1 !rounded-lg"
+ :placeholder="$t('general.submit')"
+ data-testid="nc-form-submit-button-label"
+ :disabled="isLocked || !isEditable"
+ @update:value="(value) => {
+ const meta = parseProp(formViewData.meta) || {}
+ meta.submit_button_label = value
+ formViewData.meta = meta
+ updateView()
+ }"
+ />
+ </div>
+ </div>
+ </template>
+ </PaymentUpgradeBadgeProvider>
+
<!-- Show this message -->
<div v-if="!isOpenRedirectUrl" class="pb-10">
<div class="text-nc-content-gray mb-2 flex items-center">
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 24e9425c3c..017092dcbe 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -105,6 +105,7 @@
"upgradeToAddCustomLogoSubtitle": "Upload your Logo on the form by upgrading your workspace to the {plan} plan.",
"upgradeToHideFormBrandingSubtitle": "Hide NocoDB branding by upgrading your workspace to the {plan} plan.",
"upgradeToAddRedirectUrlSubtitle": "Redirect your users to another webpage after filling out the form by upgrading to the {plan} plan.",
+ "upgradeToCustomizeSubmitButtonSubtitle": "Customize the submit button label by upgrading your workspace to the {plan} plan.",
"upgradeToAddCustomValidationSubtitle": "Add custom validations by upgrading your workspace to the {plan} plan.",
"upgradeToAddCustomUrlSubtitle": "Create custom URL by upgrading your workspace to the {plan} plan.",
"upgradeToAccessPersonalViewSubtitle": "Access Personal view feature by upgrading your workspace to the {plan} plan.",
@@ -1867,6 +1868,8 @@
"refreshProject": "Refresh Base",
"saveProject": "Save Base",
"saveAndQuit": "Save & Quit",
+ "customizeSubmitButton": "Customize Submit Button",
+ "submitButtonLabel": "Submit Button Label",
"deleteKanbanStack": "Delete stack?",
"createProjectExtended": {
"extDB": "Create By Connecting <br>To An External Database",
diff --git a/packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/index.vue b/packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/index.vue
index 086d3ada26..88cb82c45d 100644
--- a/packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/index.vue
+++ b/packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/index.vue
@@ -279,17 +279,7 @@ const { message: templatedMessage } = useTemplatedMessage(
</div>
<div class="flex justify-between items-center mt-6">
- <NcButton
- html-type="reset"
- type="secondary"
- :size="isMobileMode ? 'medium' : 'small'"
- :disabled="isLoading"
- class="nc-shared-form-button shared-form-clear-button"
- data-testid="shared-form-clear-button"
- @click="clearForm"
- >
- {{ $t('activity.clearForm') }}
- </NcButton>
+ <div></div>
<NcButton
:disabled="progress"
@@ -299,7 +289,7 @@ const { message: templatedMessage } = useTemplatedMessage(
data-testid="shared-form-submit-button"
@click="submitForm"
>
- {{ $t('general.submit') }}
+ {{ sharedFormView?.meta && parseProp(sharedFormView.meta)?.submit_button_label || $t('general.submit') }}
</NcButton>
</div>
</div>
diff --git a/packages/nocodb-sdk/src/lib/payment/index.ts b/packages/nocodb-sdk/src/lib/payment/index.ts
index ee4518fa26..a826e2dacf 100644
--- a/packages/nocodb-sdk/src/lib/payment/index.ts
+++ b/packages/nocodb-sdk/src/lib/payment/index.ts
@@ -42,6 +42,7 @@ export enum PlanFeatureTypes {
FEATURE_FILE_MODE = 'feature_file_mode',
FEATURE_FORM_URL_REDIRECTION = 'feature_form_url_redirection',
FEATURE_FORM_CUSTOM_LOGO = 'feature_form_custom_logo',
+ FEATURE_FORM_CUSTOM_SUBMIT_LABEL = 'feature_form_custom_submit_label',
FEATURE_FORM_FIELD_ON_CONDITION = 'feature_form_field_on_condition',
FEATURE_FORM_FIELD_VALIDATION = 'feature_form_field_validation',
FEATURE_GROUP_BY_AGGREGATIONS = 'feature_group_by_aggregations',
@@ -243,6 +244,7 @@ export const PlanFeatureUpgradeMessages: Record<PlanFeatureTypes, string> = {
[PlanFeatureTypes.FEATURE_FORM_URL_REDIRECTION]:
'to access redirect after form submission feature',
[PlanFeatureTypes.FEATURE_FORM_CUSTOM_LOGO]: 'to add a custom logo to forms.',
+ [PlanFeatureTypes.FEATURE_FORM_CUSTOM_SUBMIT_LABEL]: 'to customize the submit button label.',
[PlanFeatureTypes.FEATURE_FORM_FIELD_ON_CONDITION]:
'to access conditional form fields feature',
[PlanFeatureTypes.FEATURE_FORM_FIELD_VALIDATION]: