[Zope] redirection problem

Larry McDonnell larry at technologyinedu.com
Wed Sep 29 17:51:56 EDT 2004


J Cameron Cooper wrote:

> Larry McDonnell wrote:
>
>> I have run into a wall. I am trying to use a pull down menu to 
>> redirect the form to another page.
>>
>> <select name="form_action_type" size="1">
>>
>> <dtml-in lookup_action_query sort=school_name>
>>   <OPTION VALUE="<dtml-var action_file_location>">
>>   <dtml-var school_name> <dtml-var sport_type>
>>   </OPTION>
>> </dtml-in>
>> </SELECT>
>>
>> action_file_location hold the path to where I am trying to get to. I 
>> tried this
>> <form method="post" action=<dtml-var expr="form_action_type">>
>>
>> But I get a key error. I am trying to do this on the same form.Can I 
>> do this? Can some point me in the right direction.
>
>
> How is DTML to know what the selected value of the HTML widget is? 
> Remember that the choice is client side and the rendering is all 
> server side. If it doesn't exist in the namespace upon rendering, a 
> name will never be found, thus your key error.
>
> The object to which this form is submitted will have 
> 'form_action_type' in the REQUEST, however.
>
> You have two options:
>
> 1. use Javascript to change the form's action value upon change in the 
> widget.
>
> 2. create a Python script and submit the form to that. The script will 
> look up the value in the REQUEST and do a redirect. This will look 
> something like::
>
>   ## parameters=form_action_type
>
>   context.REQUEST.RESPONSE.redirect(form_action_type)
>
>
> I like #2 because it doesn't rely on browser capabilities. Your other 
> option is to restructure your UI: make it a list of links and the 
> problem goes away. May or may not be feasible.
>
>             --jcc
>
Thanks, I would like to try Python  too.

Larry


More information about the Zope mailing list