24
How Do I

Save and publish

Trigger save and publish from outside the builder component.

The builder exposes save(), publish(), unpublish(), and togglePublishState() through a component ref. Use that when you want your own toolbar or workflow buttons.

app/components/FormEditor.vue
<script setup lang="ts">
import type { FormForgeBuilderExpose } from '@evanschleret/formforgeclient'

const builder = ref<FormForgeBuilderExpose | null>(null)

async function saveForm(): Promise<void> {
  await builder.value?.save()
}

async function publishForm(): Promise<void> {
  await builder.value?.publish()
}
</script>

<template>
  <FormForgeBuilder
    ref="builder"
    :load-form-key="formKey"
    hide-settings
    auto-publish-on-save
  />
</template>

Notes

  • autosave still works when enabled.
  • autoPublishOnSave publishes successful saves automatically.
  • hideSettings only affects the UI; it does not change the form schema.

Use autoPublishOnSave for workflows that must stay published after every successful save.