how: passing a list as a hidden variable from doc to doc
Hello Zopistas, I've come across this problem, (which delays my whole project and upsets my employer): I have a Form that displays a list of files for deletion and a checkbox for each file to select it: <dtml-in "prjfolder.objectIds('File')" skip_unauthorized> <input type=checkbox name=del_list value=<dtml-var sequence-item>> [...] Users can check the files they want to delete. They submit the form to the next dtml-method, say "delete". all checked filenames are passed to this method as a list object, e.g.: ['file1', 'file2', 'file3']. If I pass this list object to manage_delObjects(del_list), everything goes fine. The objects are deleted. Logical flow: select -> delete BUT: I have to ask the user if he really wants to delete the files. Thus: select -> ask -> delete So I need to pass the list of filenames through that darn "ask" document. There I did something like: <input type=hidden name=del_list:list value="<dtml-var "REQUEST['del_list']">"> this renders to: <input type=hidden name=del_list:list value="['file1', 'file2', 'file3']"> (Note: I did the :list type conversion. I also tried tokens, lines, whatever...) If the user chooses to delete, I finally call my delete document, which is supposed to delete the files in the list. but the call to manage_delObjects(del_list) fails with: Error Value: ['file1', 'file2', 'file3'] does not exist How do I pass a list object from one document to another? It always somehow becomes a string, breaking everything. There must be a clean way; I do not want to do string magic with split or so. Anyone help me out, please. thanks in advance, Heiko -- heiko.stoermer@innominate.de innominate AG networkingpeople fon: +49.30.308806-0 fax: -77 web: http://innominate.de
Heiko Stoermer wrote:
Hello Zopistas,
<introduction to problem snipped>
So I need to pass the list of filenames through that darn "ask" document. There I did something like: <input type=hidden name=del_list:list value="<dtml-var "REQUEST['del_list']">"> this renders to: <input type=hidden name=del_list:list value="['file1', 'file2', 'file3']">
Instead of the above, try this: <inputy type=hidden name=del_list:list value=file1> <inputy type=hidden name=del_list:list value=file2> <inputy type=hidden name=del_list:list value=file3> ..and so on. Hope this helps, Shalabh
thanks for helping out. greetings, Heiko -- heiko.stoermer@innominate.de innominate AG networkingpeople fon: +49.30.308806-0 fax: -77 web: http://innominate.de
Heiko Stoermer schrieb: [...]
I have to ask the user if he really wants to delete the files. Thus: select -> ask -> delete
So I need to pass the list of filenames through that darn "ask" document. There I did something like: <input type=hidden name=del_list:list value="<dtml-var "REQUEST['del_list']">"> this renders to: <input type=hidden name=del_list:list value="['file1', 'file2', 'file3']"> (Note: I did the :list type conversion. I also tried tokens, lines, whatever...)
Lists passing from REQUEST to REQUEST is a bit trickier. You have to rebuild the list again. try (untested): <dtml-in del_list> <input type=hidden name=del_list:list value="<dtml-var sequence-item>"> </dtml-in> (and as a side effect you can give the user the possibility to check any single file, which he had choosen) hth, Thomas -- fon: ++49 (0)40 42878 3781 fax: ++49 (0)40 42878 2728
thanks for helping out. greetings, Heiko -- heiko.stoermer@innominate.de innominate AG networkingpeople fon: +49.30.308806-0 fax: -77 web: http://innominate.de
Heiko Stoermer: You pass them as multiple hidden fields like so: <dtml-in del_list> <input type=hidden name=del_list:list value="<dtml-var sequence-item>"> </dtml-in>
Hello Zopistas, I've come across this problem, (which delays my whole project and upsets my employer):
I have a Form that displays a list of files for deletion and a checkbox for each file to select it: <dtml-in "prjfolder.objectIds('File')" skip_unauthorized> <input type=checkbox name=del_list value=<dtml-var sequence-item>> [...]
Users can check the files they want to delete. They submit the form to the next dtml-method, say "delete". all checked filenames are passed to this method as a list object, e.g.: ['file1', 'file2', 'file3']. If I pass this list object to manage_delObjects(del_list), everything goes fine. The objects are deleted.
Logical flow: select -> delete
BUT: I have to ask the user if he really wants to delete the files. Thus: select -> ask -> delete
So I need to pass the list of filenames through that darn "ask" document. There I did something like: <input type=hidden name=del_list:list value="<dtml-var "REQUEST['del_list']">"> this renders to: <input type=hidden name=del_list:list value="['file1', 'file2', 'file3']"> (Note: I did the :list type conversion. I also tried tokens, lines, whatever...)
If the user chooses to delete, I finally call my delete document, which is supposed to delete the files in the list. but the call to manage_delObjects(del_list) fails with: Error Value: ['file1', 'file2', 'file3'] does not exist
How do I pass a list object from one document to another? It always somehow becomes a string, breaking everything. There must be a clean way; I do not want to do string magic with split or so.
Anyone help me out, please.
thanks in advance, Heiko
-- heiko.stoermer@innominate.de innominate AG networkingpeople fon: +49.30.308806-0 fax: -77 web: http://innominate.de
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
participants (4)
-
Jason Spisak -
news-list.zope@innominate.de -
Shalabh Chaturvedi -
Thomas Weiner