Zope not listening to trinkets
This is in line with the previous email about the 'list' variable called 'things' that is giving me back ['my_list_item1','my_list_item2'] for sequence-items instead of just the strings. I looked at the form from which these values can and I am using: <input type="hidden" name="things:list" value="<!--#var "REQUEST['things']"-->"> a hidden value that I got froma previous form (Which was also a list) The sequence-items show up as strings fine on the page with the above code, but when I try to use the hidden filed to move it to the next page, Zope ignores the trinket. Can someone duplicate/ or has noticed this? All my best, -- Jason Spisak webmaster@hiretechs.com
Jason Spisak wrote:
<input type="hidden" name="things:list" value="<!--#var "REQUEST['things']"-->">
a hidden value that I got froma previous form (Which was also a list) The sequence-items show up as strings fine on the page with the above code, but when I try to use the hidden filed to move it to the next page, Zope ignores the trinket.
This is a common error, so don't feel bad <wink>. While ':list' form variables *produce* a single list, their values are single list elements, not entire lists. You *can* produce a list from a single value with ':tokens' and ':lines' variables. Instead of the above, do this: <dtml-in things> <input type="hidden" name="things:list" value="<dtml-var sequence-item>"> </dtml-in> or this (if your things *never* contain newlines) <input type="hidden" name="things:lines" values="<dtml-var "_.string.join(things, '\n')">">
Evan, Well you answered my question. I had'nt read your mail when I fired off that response to Martjin. Thanks!
Instead of the above, do this:
<dtml-in things> <input type="hidden" name="things:list" value="<dtml-var sequence-item>">
</dtml-in>
or this (if your things *never* contain newlines)
<input type="hidden" name="things:lines" values="<dtml-var "_.string.join(things, '\n')">">
Jason Spisak webmaster@hiretechs.com
At 22:32 22/09/99 , Jason Spisak wrote:
This is in line with the previous email about the 'list' variable called 'things' that is giving me back ['my_list_item1','my_list_item2'] for sequence-items instead of just the strings. I looked at the form from which these values can and I am using:
<input type="hidden" name="things:list" value="<!--#var "REQUEST['things']"-->">
a hidden value that I got froma previous form (Which was also a list) The sequence-items show up as strings fine on the page with the above code, but when I try to use the hidden filed to move it to the next page, Zope ignores the trinket.
You are putting the string representation of your 'things' list in to a hidden field, and that string representation is then marshalled in to a list of exactly one item, the string representation. This is because HTML has no concept of lists. You should turn your list into a set of hidden field, one for each item on that list. By adding the :list modifier to the fieldname, Zope will then convert it back to a list when the FORM is posted again: <dtml-in things> <input type=hidden name="things:list" value="&dtml-things;"> </dtml-in> Note that I use the HTMNL entity notation here (&dtml-variablename;), which will HTML quote your value, so that any of the <, >, or " characters will not mess up the HTML. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Martijn, Could I also use sequence-item as in: <dtml-in things> <input type=hidden name="things:list" value="&dtml-var sequence-item;"> </dtml-in>
At 22:32 22/09/99 , Jason Spisak wrote:
This is in line with the previous email about the 'list' variable called 'things' that is giving me back ['my_list_item1','my_list_item2'] for sequence-items instead of just the strings. I looked at the form from which these values can and I am using:
<input type="hidden" name="things:list" value="<!--#var "REQUEST['things']"-->">
a hidden value that I got froma previous form (Which was also a list) The sequence-items show up as strings fine on the page with the above code, but when I try to use the hidden filed to move it to the next page, Zope ignores the trinket.
You are putting the string representation of your 'things' list in to a hidden field, and that string representation is then marshalled in to a list of exactly one item, the string representation. This is because HTML has no concept of lists.
You should turn your list into a set of hidden field, one for each item on that list. By adding the :list modifier to the fieldname, Zope will then convert it back to a list when the FORM is posted again:
<dtml-in things> <input type=hidden name="things:list" value="&dtml-things;"> </dtml-in>
Note that I use the HTMNL entity notation here (&dtml-variablename;), which will HTML quote your value, so that any of the <, >, or " characters will not mess up the HTML.
Jason Spisak
At 09:21 23/09/99 , Jason Spisak wrote:
Martijn,
Could I also use sequence-item as in:
<dtml-in things> <input type=hidden name="things:list" value="&dtml-var sequence-item;"> </dtml-in>
*Blush* Ehmm... in fact, you _have_ to use sequence-item... =/ Sorry. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (4)
-
Evan Simpson -
Jason Spisak -
Jason Spisak -
Martijn Pieters