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

Floating label doesn't work on input[type=email] when value is not valid #237

Closed
eliashdezr opened this issue Dec 7, 2016 · 10 comments
Closed
Assignees
Milestone

Comments

@eliashdezr
Copy link

Using this code

<div class="floating-label">
  <input required="required" type="email" class="full-width">
<label>Email</label></div>

And typing anything without the @ causes this behavior on the label:
2016-12-06 23_12_46-asistente asesores

@vuchl
Copy link

vuchl commented Dec 7, 2016

Hmm that's kind of strange. from https://github.com/quasarframework/quasar/blob/dev/src/css-components/textfield/textfield.mat.styl and https://github.com/quasarframework/quasar/blob/dev/src/css-components/textfield/textfield.ios.styl there is not difference in the types of input tags to be seen. But maybe I'm looking at the wrong part of the code.

@rstoenescu
Copy link
Member

New component coming soon for floating label.

@eliashdezr
Copy link
Author

@rstoenescu Cool!

Btw, just wanted to add another strange behavior on the password input label:
2016-12-07 04_07_13-asistente asesores

Hope this helps in the new component!

@CookieJon
Copy link
Contributor

@eliashdezr Thanks, I'll make sure that's included in the fix (which I'm doing now)

@rstoenescu
Copy link
Member

PR is being worked on by @CookieJon

@oswaldofreitas
Copy link
Contributor

@CookieJon @rstoenescu Don't know if you found the solution, I guess the problem happens here:

https://github.com/quasarframework/quasar/blob/dev/src/css-components/textfield/textfield.mat.styl#L67 (input:valid)

I was investigating how MaterializeCss solve this, they put a .active class via jQuery into input when it doesn't have focus or when it have a value.

@eliashdezr as a workahound for now you could remove type="email" from input and validate it with vuelidate (it has an email validator out of the box)

@rstoenescu
Copy link
Member

Consider this solved. There's a mega-patch coming up for form components.

@oswaldofreitas
Copy link
Contributor

oswaldofreitas commented Feb 9, 2017

Do you have a planned date for this to be released?

Please, consider creating a q-input with properties like: label, label type (floating, stacked, left).

Would be nice to have integration with validation showing message (could have a rule property).

So, instead of:

<div class="floating-label">
  <input required class="full-width"
    v-model.trim="vm.email" @change="$v.vm.email.$touch()"
    :class="{'has-error': $v.vm.email.$error}">
  <label>E-mail</label>
</div>
<div v-if="$v.vm.email.$error" class="text-negative">
  <small v-if="!$v.vm.email.required">E-mail is mandatory</small>
  <small v-if="!$v.vm.email.email">Please, inform a valid e-mail</small>
</div>

We could have:

<q-input label="E-mail" label-type="floating" v-model.trim="vm.email" validation-rule="email"></q-input>

class="full-width" by default

validation object could be something like

email {
  required: { message: "E-mail is mandatory" },
  email: { message: "Please, inform a valid e-mail" }
}

@rstoenescu
Copy link
Member

@oswaldomilet It's exactly what I've been working on the whole week :) + more other form related things.

@rstoenescu rstoenescu modified the milestones: v0.14, v0.15 Feb 24, 2017
@rstoenescu
Copy link
Member

Will be available in v0.14

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