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

How to change Input box red color while input box empty #128

Open
senthilmca90 opened this issue Aug 8, 2019 · 3 comments
Open

How to change Input box red color while input box empty #128

senthilmca90 opened this issue Aug 8, 2019 · 3 comments
Assignees

Comments

@senthilmca90
Copy link

senthilmca90 commented Aug 8, 2019

Hi, this is finding simple validation, but while hitting the submit button the input box is not showing red color

image

anyone can help me how to write condition red color bor.

@stuyam stuyam self-assigned this Aug 14, 2019
@damanmokha
Copy link

Hi, any update on that? @senthilmca90 did you managed to find the solution

@stuyam
Copy link
Collaborator

stuyam commented Nov 12, 2020

My suggestion would be to define the validator above the input maybe in the top of the render() method for example and assign it to a variable. That way you can use the response to check if you should show a different border for the input and show the message below for example. If nothing is returned that means validation passed and will be null. Something like this:

render() {
  let emailValidator = this.validator.message('email', this.state.email, 'required|email')
  return (
    <div>
      <input className={emailValidator ? 'border-red' : 'border-default'} ....../>
      {emailValidator}
    </div>
  )
}

@Hansi4348
Copy link

how we do this in react native ?

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

4 participants