Skip to content
Discussion options

You must be logged in to vote

I don't know if this is really Inertia related, but more Vuejs related. You should be able to pass the form object down to the component using model binding.

Create.vue

<template>
  <form @submit.prevent='addContact'>
    <ContactForm v-model:contact="form.contact" />
  </form>
</template>

<script>
import { useForm} from '@inertiajs/vue3';
import ContactForm from '~/_Form.vue';

const form = useForm({
  contact: {
    name: '',
    email: '',
  },
  someOtherData: {
    product_id: null
  },
});

const addContact = () => {
  form.post(route('contacts.store'), {
    errorBag: 'addContact',
    preserveScroll: true,
  });
};
</script>

ContactForm.vue

<template>
  <div>
    <InputLabel
      

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by philyboysmith
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants