Forum: Radiant CMS Is there any kind of validation in the mailer extension?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nate T. (Guest)
on 2008-11-15 18:26
(Received via mailing list)
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
Hamish Rickerby (Guest)
on 2008-11-16 10:20
(Received via mailing list)
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" >
     <p>Message <r:mailer:error:message /></p>
   </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" >
     <p><r:mailer:error:message /></p>
   </r:mailer:error>

Hope that helps.

Thanks,

::: hamish rickerby :::
m: removed_email_address@domain.invalid

http://glimmerdesign.com
This topic is locked and can not be replied to.