And it does what it is supposed to… but the thing is… atm im getting the “field required” text above an empty input field if i leave it blank, but what I want is the inputfield to get a red border/focus and nothing more. I don’t want the “field required” text etc… ONLY a red border for a more clean look.
As far as I can see, the script is doing what it should.
You have two input fields “name” and “email”, as well as a textarea “message” and in the rules that you posted above, you have marked all of them as required.
When I enter something into one of the fields and it is flagged as incorrect, when I click back into the field to alter my initial entry, the field is cleared automatically and I have to start over.
Not very user friendly …
Yeah. Maby I was unclear, i want it to do what it does, but instead of echoing out “field required” etc when i leave something blank, i want the field to get a red border… so… no text just red border=) Is this possible to do?
Well, the fields which fail validation get assigned a class of error, so you could use that:
.error{ border: 1px solid red; }
As for the error messages, you can remove them in a number of ways.
However before doing so consider whether this a good idea, as it will stop users from submitting the form without giving them a reason why.
If you’re sure this is what you want to do, I believe this will work:
another thing, do you know how to make the validation to ignore the input values that are already there like “your name here”, atm the validation accept that as a name.