Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
168
rated 0 times [  170] [ 2]  / answers: 1 / hits: 5174  / 3 Years ago, thu, february 18, 2021, 12:00:00

I am making a website that has a select form and datepicker form that sends an API request for data. I want to the update the data on every change of these forms, then a "submit" button is not required.


The select works perfectly by using the "@change", but this does not have any effect on the datepicker.


The template is.


<div class="d-flex flex-row flex-nowrap">
<b-form-select v-model="region"
:options="regions"
class="select_box"
@change="get_data()"
/>
<b-form-datepicker id="first_day_datepicker"
v-model="first_day"
:min="min_day"
:max="max_day"
class="mb-2"
@change="get_data()"
/>
<b-form-datepicker id="last_day_datepicker"
v-model="last_day"
:min="min_day"
:max="max_day"
class="mb-2"
@on-change="get_data()"
/>
</div>

And the funtcion looks like this(simplified for example)


methods: {
get_data() {
console.log("Change data")
},
}

More From » vue.js

 Answers
1

The <b-form-datepicker> control has no change event in its event list.


But it does have an input event which gets emitted when updating v-model:


<b-form-datepicker id="first_day_datepicker"
v-model="first_day"
:min="min_day"
:max="max_day"
class="mb-2"
@input="get_data()"
/>
<b-form-datepicker id="last_day_datepicker"
v-model="last_day"
:min="min_day"
:max="max_day"
class="mb-2"
@input="get_data()"
/>

[#1776] Friday, February 12, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ravenl

Total Points: 338
Total Questions: 107
Total Answers: 112

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
ravenl questions
Tue, Jan 12, 21, 00:00, 3 Years ago
Tue, Mar 17, 20, 00:00, 4 Years ago
Tue, Dec 3, 19, 00:00, 5 Years ago
;