Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation #73

Open
jscottwillems opened this issue Jul 29, 2020 · 4 comments
Open

Validation #73

jscottwillems opened this issue Jul 29, 2020 · 4 comments

Comments

@jscottwillems
Copy link

Having trouble finding a way to validate this component. If I try to use the "rules" prop on either the datePickerProps or timePickerProps it breaks the code. Is there an existing prop for this component for passing in validation rules or is this something that has yet to be handled?

@devstack-be
Copy link

devstack-be commented Jul 29, 2020

If it can help you, i did the following on my project:

 <ValidationProvider v-slot="{ errors }" name="Datetime" rules="required">
                                                    <v-datetime-picker
                                                        :error-messages="errors"
                                                        :text-field-props="{dense: true, prependIcon: 'event'}"
                                                        :date-picker-props="dateProps"
                                                        :time-picker-props="timeProps"
                                                        label="Date & Time"
                                                        v-model="selectedEventLocal.datetime">
                                                    </v-datetime-picker>
                                                </ValidationProvider>

But to do this (:error-messages) i had to fork the repo and do this: code

Hope it helps.

@airrakedev
Copy link

Thanks, bro @devstack-be, it did help me

@atle-granlund
Copy link

For others who is looking for validation you can just add :textFieldProps="{ rules: [v => !!v || "You have to select a date!"] }" as an example,

@tonybelloni
Copy link

The option above with a simple rule is working fine. In Vuetify components it's possible to use a method to validate more complex rules. Is it possible to use a rule with this component ? If not, how to validate complex validation rules ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants