Lee writes:
... several recipients from form to sendmail ... I just skipped your question. Not sure, that I got it right.
DTML does not have true variables with assignments. However, you can use the REQUEST object as a variable container. If your problem is to collect all recipients from the form and feed them to "sendmail" you could do something like this: <dtml-call "REQUEST.set(recipients,[])"> <dtml-in "REQUEST.form.items()"> ... <dtml-call "recipients.append(_['sequence-item'])"> ... </dtml-in> <dtml-sendmail ...> To: <dtml-var "_.string.join(recipients,', ')> .... </dtml-sendmail> You can even let ZPublisher form the list for you: give all form variables that will contain a recipient the name "recipients:list:ignore_empty" Then, if at least one of these fields got a value, you REQUEST will have a variable "recipients" containing a list with all these fields. I would like to point you to Python's "in" operator. Instead of _['sequence-key'] == 'message') or or (_['sequence-key'] == 'sender') or (_['sequence-key'] == 'senderEmail') or (_['sequence-key'] == 'subject') you can write: _['sequence-key'] in ('message','sender','senderEmail','subject') Easier to write and to read. Dieter
Hi Dieter, Thanks again for your help :) I'm having some trouble creating the new variable in REQUEST - maybe you know why? The REQUEST object holds: KEY ITEM lreilly lreilly (recipient - '@cs.strath.ac.uk' is appended) ltlyer ltyler (recipient - '@cs.strath.ac.uk' is appended) subject >subject< sender >sender< message >message< senderEmail >senderEmail< But when I add in the code to create 'recipients' in the REQUEST object and then try and view REQUEST's contents again I get an error:
Error Type: NameError Error Value: recipients
Here's the method: ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,, <dtml-var standard_html_header> <dtml-call "REQUEST.set(recipients,[])"> <dtml-in "REQUEST.form.items()"> <dtml-if expr="_['sequence-key'] in ('message','sender','senderEmail','subject')"> <input type="hidden" name="<dtml-var name="sequence-key">" value="<dtml-var name="sequence-item">"> <dtml-else> <dtml-call "recipients.append(_['sequence-key'])"> </dtml-if> </dtml-in> <dtml-in expr="REQUEST.form.items()"> <dtml-var name="sequence-key">: <dtml-var name="sequence-item"><br> </dtml-in> <dtml-var standard_html_footer> ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,, Can you see any obvious problems? Thanks very much for your time. - Best regards, Lee -- Lee Reilly mailto:lee.reilly@ntlworld.com ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,,,, HAVE SKILLS; WILL TRAVEL. I'm currently looking for an internship in the USA in the field of web development. Ideally, I'm looking for a placement for 3 to 18 months. Can you help? More details, my resume, etc. @ http://homepages.strath.ac.uk/~aeu97172/ </shameless plug>
participants (2)
-
Dieter Maurer -
Lee