I need a name space expert to please answer the following question. Why can't I access row_items in the following senario: dtml document (index): has an input form with records called row_items as inputs. On submit it calls form2 ( post ). dtml document "form2": it uses row_items just fine. it also has an input form and simply calls form3 (post) on submit. dtml document "form3": it cannot find row_items -- i don't understand why, I thought namespaces where stacked on top of each other, can someone help please. Thanks ahead of time, Luis.
Luis Cortes wrote:
I need a name space expert to please answer the following question. Why can't I access row_items in the following senario:
dtml document (index): has an input form with records called row_items as inputs. On submit it calls form2 ( post ).
dtml document "form2": it uses row_items just fine. it also has an input form and simply calls form3 (post) on submit.
dtml document "form3": it cannot find row_items -- i don't understand why, I thought namespaces where stacked on top of each other, can someone help please.
Thanks ahead of time, Luis.
long answer: This has more to do with how http works than zope. http(by itself) is a stateless protocol between pages. Each page request is independent from any other. When you submit a form the client calls the new page with those form variables. in your case form1 sets up some variables which the client browser calls form2 with. in form2 you have access to those variables within zope. if you don't send them in either a form or a cookie than they won't be apparent to form3. namepaces in zope are stacked on top each other in a single request what you have access to is determined by acquisition & inheritance, for more info on acquisition check out Jim F.'s talk form IPC8 on the zope home page. short solution: you basically want to add some hidden variables to your form2 like <input type="hidden" value="<dtml-var row-items>" name="row-items> Kapil www.sin.wm.edu
Kapil Thangavelu wrote:
short solution: you basically want to add some hidden variables to your form2 like <input type="hidden" value="<dtml-var row-items>" name="row-items>
This is essentially the correct answer, note that if row-items is a sequence then you have to be more clever: <dtml-in row-items> <input type=hidden name="row-items:list" value="<dtml-var sequence-item>"> </dtml-in> -Michel
Michel Pelletier wrote:
Kapil Thangavelu wrote:
short solution: you basically want to add some hidden variables to your form2 like <input type="hidden" value="<dtml-var row-items>" name="row-items>
This is essentially the correct answer, note that if row-items is a sequence then you have to be more clever:
<dtml-in row-items> <input type=hidden name="row-items:list" value="<dtml-var sequence-item>"> </dtml-in>
-Michel
hmm... things are a bit simpler i think if you do form coercion(:list, :int) in form1 than call another form2, form2 has access to the variables in their coerced form, so the coercion is not needed although its a good idea for code documentation and if the form can be called from places other than form1. even if you want to use coercion again in the second form you don't need to use <dtml-in>, just calling <input type=hidden name="row-items:list" value="<dtml-var row-items>"> will insert a list. Kapil www.sin.wm.edu
participants (3)
-
Kapil Thangavelu -
Luis Cortes -
Michel Pelletier