[Product-Developers] Re: add S&D subscriber on form submission

Daniel Nouri daniel.nouri at gmail.com
Thu May 29 09:55:00 UTC 2008


Daniel Widerin writes:

> seems nobody can answer this in user mailinglist, so let's try here:

Sorry, I didn't read this in the users list.  Note that there's also a
S&D list: http://groups.google.com/group/singing-dancing

> i've done an order form using formlib with a checkbox "i want to
> subscribe to the newsletter".
>
> if i hit the order button (and do the whole stuff for ordering) i want
> to easy add a subscriber to singing & dancing newsletter (using
> default channel).
>
> what is the easiest way to do this if i don't want to lose the
> email-validation / activation.

Look at ``collective.singing.browser.subscribe.Subscribe.finish``.

You can ignore the first part about collecting ``collector_data`` and
``composer_data``, as you'll provide your own form data there.  These
are simply dictionaries.  There's also ``metadata`` containing
``format``, ``date``, and ``pending``.

Towards the end of the method, you can see how a confirmation message is
sent out.

Regarding e-mail validation: You'd probably want your form to do this.
For this, you can reuse the ``collective.dancing.composer.check_email``
constraint in your form's schema.


-- 
Daniel Nouri
http://danielnouri.org





More information about the Product-Developers mailing list