问题
For some reason I'm getting two different kinds of error messages on the same SS 3 form as shown in the referenced screenshot. How do I get rid of the text bubble style error message on the email field and have them all look like the error box on the name field?
Screenshot: http://d.pr/i/ThmL
Bob
回答1:
In SilverStripe 3.0/1 it enabled the use of the HTML5 required attributes which web browsers pick up and do their own validation for (which you've seen).
If you want to stop the browser behaviour remove the required attribute from the markup SilverStripe provides
TextField::create('MyTextField')->setAttribute('required', false)
This will still make the form field required in the PHP validation but disable the browser popup.
来源:https://stackoverflow.com/questions/18647516/eliminate-text-bubble-error-on-silverstripe-3-forms