[Zope] Object ids in the select

Hung Jung Lu hungjunglu@hotmail.com
Thu, 24 Feb 2000 06:56:37 PST


"sin hang kin" <iekentsi-@infoez.com.mo> wrote:
>
><form action="setmember" method="post">
><select name="members" size="10" multiple>
><dtml-in catalog>
>    <option value="<dtml-var catalog.getobject(data_record_id_)>">
>    <dtml-var title>
>    </option>
></dtml-in>
></select>
><input type="submit" value="addmembers">
></form>
>
>How I can retrieve the object-ids in setmember. If setmember is a python
>method, what is passed to it?

(1) First of all, change the name of your selection
    variable from "members" to "members:list". Whenever you
    are doing a multiple selection, you SHOULD append the
    ":list" qualifier, otherwise you get into trouble with
    the particular case of single item selected.

    You may also want to get into the habit of using the
    ":method" tag for the submit button names. This helps
    when you have multiple submit buttons.

    <form action="myFolderURL" method="post">
    ....
    <input type="submit"
     name="myDTMLMethodName:method" value="addmembers">
    ....

    If you can't find documentation on the ":list" and
    ":method" tag, don't worry, you are not alone. :)

(2) The returned ids are in REQUEST.Form.members, or directly
    accessble also as REQUEST.members or simply members.
    It's a Python list. So you can do things like

    <dtml-in members>
        ... do things with <dtml-var sequence-item>,
            or _['sequence-item']
    </dtml-in>

(3) I wouldn't recommend an external method to handle
    form requests. If you really want to handle things
    using external methods, then your declaration should
    not have any argument except self.

    def setmember(self):
        ....

    Then you access the rest through self.REQUEST or
    self.aq_acquire('attributeName').

    Most people use DTML methods/documents to handle
    form requests.

>I have the which collect objects in its attribute as a list.

I don't understand what you mean here. English problem?

regards,

Hung Jung

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com