Forum OpenACS Development: Strange behaviour with simple form and mail lite

Hi,

I've developed a small dotLRN package which creates a form using ad_form and then mails the contents of the form to various addresses using acs_mail_lite::send.

I've got a bizarre behaviour whereby if I add this portlet into a community, then it will only send the mail if it is in page_num=0, to so, what you would expect to be the community 'home page'. If I add it to any other page the mail does not send.

I'm using the acs_mail_lite in - on_submit to do the send.

It's left me rather confused!

Matthew

Collapse
Posted by Derick Leony on
Add the parameter page_num as optional in your portlet and add the switch -export {page_num} to your form. More than a strange behaviour of acs_mail_lite::send, this is due to a tricky way to use forms in portlets.

Derick

Collapse
Posted by Matthew Coupe on
Cheers Derick,

That sorted the problem, I used: set page_num [ns_queryget page_num] to get the page number and then exported it as you said.

You've saved me a lot more time messing around with bits of code.

Matthew

Collapse
Posted by Malte Sussdorff on
Quick question. Are you using the acs-mail-lite/lib/email include for this or did you develop something from scratch. If you did the latter you probably did more work than needed :).
Collapse
Posted by Matthew Coupe on
I don't think I used the lib include. I just used the acs_mail_lite::send proc with a few parameters.

set subject " Some stuff."
set body "A mail body using some parameters from the form."

acs_mail_lite::send -send_immediately \
-to_addr $email_address($feedback_type) \
-from_addr $email \
-subject $subject\
-body $body

How could I have done a simple send using the lib include?

I'm itching for a mentor... hint hint!

Matthew

The include would have given you a full e-mail entry form and in the version that resides on HEAD you could send CC and BCC emails as well. So you would not have had to write your ad_form. Other than that the include would not provide you any benefits.