Re: [Zope] evaluating a string as an expression
On 4/3/02 9:17 pm, "Greg Conway" <greg@gmlnt.com> wrote:
Hi Tony,
Yes, this is almost exactly what I am after, however I have one further question based on your answer!
Greg, I've cc'ed the list as it may help others.
It looks like you create variables from a form, specify1, specify2 ... specifyn
Exactly! Created with a <dtml-in> loop based on an SQL method returning a variable number of rows, therefore I am unsure of the value of n.
Something like? <dtml-in stuff> <input type='text' name='<dtml-var specify_var>' value='<dtml-var specify_value>'> </dtml-in> So you end up with <input type='text' name='specify1' value='182'> <input type='text' name='specify2' value='13'> <input type='text' name='specify3' value='29'> <input type='text' name='specify4' value='27'> ???
This is easier to do in python though (pass my_list as parameter) (again, untested, and no checks to make sure those variables *do* exist)
request=context.REQUEST for a_var in my_list: print request[a_var] return printed
This is where the problem lies. I cannot create a list (afaik!) as these are variables placed in the REQUEST by a form submit button.
Oh yes you can! :) <dtml-in stuff> <input type='text' name='specify:list' value='<dtml-var specify_value>'> </dtml-in> And you use it like this in the target form. <dtml-in specify> <dtml-var sequence-item> </dtml-in> Hth Tone -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
Hi Tony, Believe it or not, I've just got around to implementing this, and this has largely solved my problem, so thanks very much!! I say largely, as what I originally wanted to do was store several lists out of the form. The lists of values from input boxes work fine. However, when trying to store list of values from sets of radio boxes, of course the sets of radio boxes now all have the same variable name (ie radio:list becoming radio[x]), and become one large set of radio boxes! I've worked round this by using list boxes instead, where I can explicitly end selections by using <select> and </select>, but I'd rather use radio boxes if I could! Is this possible, do you know? Anyway, thanks for the help from long ago! worked a treat. Regards, Greg.
-----Original Message----- From: Tony McDonald [mailto:tony.mcdonald@ncl.ac.uk] Sent: 04 March 2002 22:28 To: Greg Conway; zope Subject: Re: [Zope] evaluating a string as an expression
On 4/3/02 9:17 pm, "Greg Conway" <greg@gmlnt.com> wrote:
Hi Tony,
Yes, this is almost exactly what I am after, however I have one further question based on your answer!
Greg, I've cc'ed the list as it may help others.
It looks like you create variables from a form, specify1, specify2 ... specifyn
Exactly! Created with a <dtml-in> loop based on an SQL method returning a variable number of rows, therefore I am unsure of the value of n.
Something like?
<dtml-in stuff> <input type='text' name='<dtml-var specify_var>' value='<dtml-var specify_value>'> </dtml-in>
So you end up with
<input type='text' name='specify1' value='182'> <input type='text' name='specify2' value='13'> <input type='text' name='specify3' value='29'> <input type='text' name='specify4' value='27'>
???
This is easier to do in python though (pass my_list as parameter) (again, untested, and no checks to make sure those variables *do* exist)
request=context.REQUEST for a_var in my_list: print request[a_var] return printed
This is where the problem lies. I cannot create a list (afaik!) as these are variables placed in the REQUEST by a form submit button.
Oh yes you can! :)
<dtml-in stuff> <input type='text' name='specify:list' value='<dtml-var specify_value>'> </dtml-in>
And you use it like this in the target form.
<dtml-in specify> <dtml-var sequence-item> </dtml-in>
Hth Tone -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
On 20/5/02 4:05 am, "Greg Conway" <greg@gmlnt.com> wrote:
Hi Tony,
Believe it or not, I've just got around to implementing this, and this has largely solved my problem, so thanks very much!!
Glad it helped!
I say largely, as what I originally wanted to do was store several lists out of the form.
The lists of values from input boxes work fine.
However, when trying to store list of values from sets of radio boxes, of course the sets of radio boxes now all have the same variable name (ie radio:list becoming radio[x]), and become one large set of radio boxes!
Perhaps use different names for the radio button groups?
I've worked round this by using list boxes instead, where I can explicitly end selections by using <select> and </select>, but I'd rather use radio boxes if I could!
I don't see that it's a problem there - radio buttons/checkboxes - all ok.
Is this possible, do you know?
Should be :)
Anyway, thanks for the help from long ago! worked a treat.
No probs. Tone -- Dr Tony McDonald, Assistant Director, FMCC, http://www.fmcc.org.uk/ The Medical School, Newcastle University Tel: +44 191 243 6140 A Zope list for UK HE/FE http://www.fmcc.org.uk/mailman/listinfo/zope
participants (2)
-
Greg Conway -
Tony McDonald