How to show the required symbol (star) for fields with custom validators?

82 views
Skip to first unread message

Pablo Cantero

unread,
May 23, 2012, 10:05:42 AM5/23/12
to SimpleForm
Hey!

I'm using the gem https://github.com/alexdunae/validates_email_format_of,
it's a simple gem that define an ActiveModel::EachValidator, to
validate e-mail formats.

I'm using an ActiveModel in the contact form, all inputs associated
with rails-core-validations appear with star prepending the label, but
the e-mail input doesn't appear with the required mark.

What is simple_form using to set an input as required?


Cheers,
Pablo Cantero

Rafael Mendonça França

unread,
May 23, 2012, 10:32:03 AM5/23/12
to plataformate...@googlegroups.com
SimpleForm only shows the required mark if you are using validates_presence_of in the field. Do you have it in the email field?

Pablo Cantero

unread,
May 23, 2012, 4:27:44 PM5/23/12
to SimpleForm
Tks Rafael. Makes sense! :)

I only used validates_email_format_of.

On May 23, 11:32 am, Rafael Mendonça França <rafaelmfra...@gmail.com>
wrote:
> SimpleForm only shows the required mark if you are using validates_presence_of in the field. Do you have it in the email field?
>
> --
> Rafael Mendonça Françahttp://twitter.com/rafaelfrancahttps://github.com/rafaelfranca
> Sent with Sparrow (http://www.sparrowmailapp.com)
>
>
>
>
>
>
>
> On Wednesday, 23 May, 2012 at 11:05, Pablo Cantero wrote:
> > Hey!
>
> > I'm using the gemhttps://github.com/alexdunae/validates_email_format_of,
Reply all
Reply to author
Forward
0 new messages