Forum OpenACS Q&A: passing list from 1 form to other

hi,
  Is it possible to pass list create in file1.adp (using embeded tcl) to the next submitting file2.tcl ???
& how????

--------- file1.adp-----------
<% set descriptive_question [list] %>.

<form action="file2" method="POST" name="feedbackform" >

...........

<% lappend descriptive_question "Q1" %>

...........
</form>

--------file2.tcl---------------

--how to access list "descriptive_question " here???????????

Collapse
Posted by Brian Fenton on
I suppose the first thing to ask is why are you using embedded TCL in your .adp file? It's probably better programming practice to only put HTML in your .adp file and to have a separate file1.tcl for your TCL code.

Anyway, to answer your question, because a list is just another string, all you need to do is create a  HTML input field in your file1.adp and accept it in the ad_page_contract of your file2.tcl. You should url-encode it first.

So, add this just before the </form> in file1.adp:
<% ad_urlencode $descriptive_question %>
<input type=hidden name=descriptive_question value=@descriptive_question@>

Then in file2.tcl, in your ad_page_contract have something like:
ad_page_contract {
} {
  {descriptive_question {}}
}

Your descriptive_question list will then be available in file2.tcl.