Is there any kind of validation in the mailer extension?

I am using the mailer extension for the first time and was wondering if
there is any kind of form validation built into the extension. I looked
at
the code and I cannot find anything. Did I miss something? How are other
people doing form validation with mailer?

Thanks,

Nate

Hi Nate,

The mailer extension supports very simple validation. It enforces
mandatory fields, and ensures the “from” and “recipients” fields
exists and have an @ in the email address. The from and recipients
enforcement comes right out of the box. Nothing to do to get that
working.

To make a mandatory field, you add a required attribute

<r:mailer:textarea name=“message” required=“true” />

When that field fails validation (no content is provided) you can get
at the error messages with the mailer errors tags.

<r:mailer:error on=“message” >

Message <r:mailer:error:message />


</r:mailer:error>

the error message is “is required”.

The error messages the from and recipients fields are stored against
the “form”. To access those…

<r:mailer:error on=“form” >

<r:mailer:error:message />


</r:mailer:error>

Hope that helps.

Thanks,

::: hamish rickerby :::
m: [email protected]

http://glimmerdesign.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs