Hi,

searching two days now, didn't get it yet.
How do I pass an argument from a view to a controller function ?

I create a view with a list of users like:

user1   role    location ....
user2   role    location ....
...

the user fields are URLs pointing to a controller function called
"edit_user"

The function edit_user creates a new form which is to be populated
with the values of the user that was selected from the user list.

How can I pass e.g.  "user2" to "edit_user" function or where can I
retrieve it ?
e.g.

MODEL
db.define_table('user',
                SQLField('name'),
                SQLField('role'),
                SQLField('location'))

VIEW (list)
{{extend 'layout.html'}}

<h1>Users</h1>

<table frame="box" rules="all">
<colgroup width="200" span="5">
<th><h2>user</h2></th>
<th><h2>role</h2></th>
<th><h2>location</h2></th>

{{for item in message:}}
    {{(uname, urole, uloc) = item.split()}}
    <tr>
        <td>{{=A(uname, _href=URL(r=request, f='edit_user'))}}</td>
        <td>{{=urole}}</td>
        <td>{{=uloc}}</td>
    </tr>
{{pass}}
</table>
<br />

how can I pass "uname" to the controller function 'edit_user' or where
can I acces the information ?

I tried something like:
        <td>{{=A(uname, _href=URL(r=request, f='edit_user', args=
[uname, urole, uloc]))}}</td>

which doesn't work (invalid request),  it screws the url with
additional data so that the function edit_user will not be found.

Any idea if this is possible ? I did not find any example in the
documentation for such a case.

best regards
Stefan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to