[Zope] redirection problem

Jonathan Hobbs toolkit at magma.ca
Wed Sep 29 17:51:02 EDT 2004


From: "Larry McDonnell" <larry at technologyinedu.com>
> 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.

I have never tried tying a method to an html select tag, but I would guess
that the browser would just return a string variable (in your case the form
variable name would be 'form_action_type') containing the result of your
dtml-var tag.

What you may want to try is setting the value of the select options to a
flag value which you test in a zope method to control your redirection.

eg.

<form method="post" action="form_action_method">
    <select name="form_action_type" size="1">
       <dtml-in lookup_action_query sort=school_name>
          <OPTION VALUE="<dtml-var sequence-item>"><dtml-var school_name>
<dtml-var sport_type></OPTION>
       </dtml-in>
    </SELECT>
...

</form>

You would have a dtml method called 'form_action_method' which checked the
contents of a variable called 'form_action_type' which then takes some
action (ie. redirect)

This assumes that 'lookup_action_query' is some type of sequence that
dtml-in can loop thru.


HTH

Jonathan




More information about the Zope mailing list