Eliminate Text Bubble Error On SilverStripe 3 Forms

时光怂恿深爱的人放手 提交于 2019-12-13 05:16:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!