Forum OpenACS Development: Intrigued by a Tcl variable scope
Writing a piece of code where a listtemplate is not aware of page variables, I noticed the fact that passing product_ids through include calls do work and the values show in the ADP page. However, there are no such variables within listtemplate's scope.
i. passing product_ids through the include:
<include src="/packages/evex-event/lib/events" product_ids="@product_ids@">ii. As expected, the value of product_ids arrives in .../lib/events, and showed in the browser (adp file) ex.
@product_ids@ ... <listtemplate name="events"></listtemplate>However, when used within a listtemplate it returns "no such variable". See the chunk of code written in the ad_proc template::list::create
How do I bring the page variables into listtemplate's scope?
[07/Aug/2018:23:02:38][2470.7f65ca7fc700][-conn:evex:3:3883-] Error: Error in include template "/var/www/evex/packages/evex-event/lib/events": can't read "product_ids": no such variable called from adp_parse_ad_conn_file called from rp_serve_concrete_file /var/www/evex/packages/evex-event/www/request-proposal.adp
It turned out that I change the approach and wrote another script. I've added a form, and the variable is within a hidden input. Instead of an argument in the link, which now is the submit form button and holds another id.
I guess those 3 lines below explain much better what I've written above.
<form method="post" name="request_proposal" action="request-proposal-2" > <input type="hidden" name="product_id" id="product_id" value="@product_id;noquote@" > <include src="/packages/evex-event/lib/events" > ...