Greetings, I've got a form that has three fields. One for year, one for day, and one for month. The selection parts of the form are similar to the following: <select name="date_mm"> <option value="01">January <option value="02">February <option value="03">March <option value="04">April <option value="05">May <option value="06">June <option value="07">July <option value="08">August <option value="09">September <option value="10">October <option value="11">November <option value="12">December </select> What I'm trying to do is pull the 'date_mm' (along with the other two fields, 'date_yy' and 'date_dd') into the namespace area so I can do something like: <input type="hidden" name="event.date" value= \ "<dtml-var var_yy>-<dtml-var var-mm>-<dtml-var var-dd>"> I would expect that I can use something like: <dtml-call "REQUEST.set('var_mm', 'date_mm')"> However, that doesn't work like I'd hoped. Any help would be greatly appreciated, Jeff
----- Original Message ----- From: <jeffr@odeon.net> To: <zope@zope.org> Sent: Sunday, March 26, 2000 3:14 PM Subject: [Zope] Trouble with forms
<select name="date_mm"> <option value="01">January <option value="02">February <option value="03">March <option value="04">April <option value="05">May <option value="06">June <option value="07">July <option value="08">August <option value="09">September <option value="10">October <option value="11">November <option value="12">December </select>
I would expect that I can use something like:
<dtml-call "REQUEST.set('var_mm', 'date_mm')">
Looks to me like you're close... <dtml-call "REQUEST.set('var_mm', date_mm)"> Note that there are no quotes around date_mm. Assuming that this DTML is in something POSTed to by your form, date_mm will be available in the namespace, and you can use it like a normal variable. Kevin
What I'm trying to do is pull the 'date_mm' (along with the other two fields, 'date_yy' and 'date_dd') into the namespace area so I can do something like:
<input type="hidden" name="event.date" value= \
|------> Do not use a dot, it will cause you grief.
"<dtml-var var_yy>-<dtml-var var-mm>-<dtml-var var-dd>">
I would expect that I can use something like:
<dtml-call "REQUEST.set('var_mm', 'date_mm')">
However, that doesn't work like I'd hoped.
Your question is not quiet clear, but I will make some assumptions and then try to answer it: I assume you want to do that all in the same file, without sending a form. In this case what you want to do is not possible, because you ask the server to know something which does not exist yet. A form is created in the moment the user submits it. So here is how you do it: FILE: someForm ... <form action="someAction"> <select name="date_dd"> <option value="01">01 <option value="02">02 ... </select> <select name="date_mm"> <option value="01">January <option value="02">February ... </select> <select name="date_yy"> <option value="1999">1999 <option value="2000">2000 ... </select> <input type="submit"> </form> ... FILE: someAction ... <dtml-call "REQUEST.set('eventDate' , date_mm+'/'+date_dd+'/'+date_yy)"> ... So you combine your date AFTER the form is transmitted. I cannot think about a case, where you need it differently. If you have one, you should revise your design, since weird syntax is mostly due to bad design. Regards, Stephan -- Stephan Richter - (901) 573-3308 - srichter@cbu.edu CBU - Physics & Chemistry; Framework Web - Web Design & Development PGP Key: 735E C61E 5C64 F430 4F9C 798E DCA2 07E3 E42B 5391
participants (3)
-
jeffr@odeon.net -
Kevin Dangoor -
Stephan Richter