List Info

Thread: Call a macro from Wikipage




Call a macro from Wikipage
user name
2006-08-28 17:41:49
> Is it possible to have a html-form in a Wikipage where
a user can fill out
some textboxes/dropdown menues ...
> And after that the user press a submit
button and a macro is called which inserts some values into
the database?

> How would the "action" of the form would
look like?

I use the AddComment
macro at trac-hacks, and have looked at the source
previously and noted some
neat tricks:
http://trac-hacks.org/browser/addcommentmacro/0.9
/AddComment.py


It seems to handle it directly in the macro by calling GET
on the same
wiki page, and then taking the relevant actions 'inline'
based on the current
request/HDF context. As long as you call GET (form method)
on a wiki page,
all is normal as far as the wiki is concerned but you will
need to detect
and infer the needed information.

Another way would be to have a plugin
that extends both the wiki syntax provider (for rendering a
form), and implements
a requesthandler on /handlemyform (or something) that
acually gets called
by the action. It can then redirect back to referrer, show a
'success' page
with information, or similar.

:::simon
simoncoderesort.com
_______________________________________________
Trac mailing list
Traclists.edgewall.com
http:
//lists.edgewall.com/mailman/listinfo/trac
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )