[Zope] pass variables in a form

Tino Wildenhain tino at wildenhain.de
Mon Apr 3 07:23:01 EDT 2006


Dean Hale schrieb:
> 
> Hi,
> 
> I hope this is the correct forum to add this query, and any help 
> appreciated.
> 
> I have the following zpt which pulls in the users userid - $uid and some 
> text generated from a python script (myEV - $pass). It works fine 
> however i need to pass the variables along in a form rather than a url. 
> And i'm stuck.
> 
> the zpt url
> 
> <span tal:define="pass here/myEv">
>     <a href="" tal:define="uid python:member.getProperty('uid')" 
> tal:attributes="href 
> string:https://domain/siw_sso.signonUSER=$uid&TEXT=$pass 
> <https://domain/siw_sso.signonUSER=$uid&TEXT=$pass>" method="post">SSO 
> test</a>
> </span>       
> 
> the form needs to be in a format similar to below
> 
> <form method="post" action="https://domain/siw_sso.signon">
> <input type="hidden" name="SSO" 
> value="USER=ws0dha&HASH=daf768422238acd0899155a1757c9b5d">
>  This is a test of hardcoded single-signon <input type="submit" 
> value="for ws0dha">
> </form>
> 
> so somehow i need to pass something like below
> 
> <input type="hidden" name="SSO" value="USER=$uid&TEXT=$pass">
> 
> hope this makes sense and is it possible?

Its possible but does not make sense. In HTML-forms
the element has a name which corresponds to the
variable name you get after form data evaluation
by the server. So in your case you really want:

<form method="post" ... >
  <input type="hidden" name="USER" tal:attributes="value uid" />
  <input type="hidden" name="TEXT" tal:attributes="value pass" />
  <input type="submit" value="for ws0dha" />
</form>

(assumed you nicely pull out uid,pass and so on from your
python script)

btw, if you construct links with parameters, its by far nicer
to do this in your python script, using ZTUtils.make_query()

Regards
Tino


More information about the Zope mailing list