0

Possible Duplicate:
HTML5 form required attribute. Set custom validation message?

Simple_form has an automatic error that is generated by html5. How do you customize the content of the message to your liking?

Community
  • 1
  • 1
Justin Meltzer
  • 13,318
  • 32
  • 117
  • 182
  • Related question: http://stackoverflow.com/questions/5328883/how-do-i-style-the-html-5-form-validation-error-messages-with-css – marcospereira Apr 28 '11 at 03:41

2 Answers2

2

You can't; it's specific to the browser (and related only to HTML5; unrelated to simple_form).

Phrogz
  • 296,393
  • 112
  • 651
  • 745
  • 1
    Does this mean that the cool HTML5 forms stuff is only useful if you have a standard form? Anything non-standard forces you to do custom validation and error messages, like in the days before HTML5? – nedlud Jul 31 '11 at 23:55
  • Seems I spoke too soon. This article (http://www.alistapart.com/articles/forward-thinking-form-validation/) shows examples of using the "pattern" attribute, and putting custom messages in the "title" attribute. – nedlud Aug 01 '11 at 01:16
  • You can in fact use javascript to change the messages. See: http://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message/5276722#5276722 – Wesley Murch Aug 01 '11 at 16:43
  • You can change the text of the message, yes. You cannot change the appearance of the message. – Phrogz Aug 01 '11 at 16:54
  • The question as I read it was: "How do you customize the content of the message?" – Wesley Murch Aug 01 '11 at 17:22
  • I may have answered the wrong question. I see the word 'content' now, where I did not previously. – Phrogz Aug 01 '11 at 17:34
2

On firefox you can either use the x-moz-errormessage attribute or the title attribute.

Knu
  • 14,806
  • 5
  • 56
  • 89