You can try setting action attribute like so: <form :action="action" method="get"> and then have action data property updated in your updateCalendar method.
Set form action based on a previous selection
Hey!
I have a calendar vue component in Laravel and I need to be able to set a form action dynamically - based on what a user selects...
so - I have a select input (outside the form) that a user would select a site from:
<select name="sites" id="sites" class="tw-border tw-border-grey-400 tw-p-1 tw-rounded tw-block" v-model="siteInput" @change="updateCalendar">
<option value="">Please select a site...</option>
<option v-for="site in sites" :value="site.id">{{ site.name }}</option>
</select>
Once they've done this, it updates a calendar - and they can select the day they wish to book.
On the booking form that pops up, I need to submit it through to a specific url - based on the site id they have selected above...
for example:
<form action="/sites/1/visits/create" method="get">
Vue is quite new to me, so I'm at a bit of a loss on how to achieve this. Apologies if I've not posted enough info - happy to clarify where needed, but this is it in a nutshell!
Please or to participate in this conversation.