[Moin-user] form

Benedict Verheyen benedict.verheyen at gmail.com
Tue May 29 03:51:42 EDT 2007

Benedict Verheyen schreef:
> Hi,
> i made a search macro and it works. Now i need a form to provide
> the search word but it's not clear on how i can make a form and link
> that to the macro or do i need an action for that?
> Thanks,
> Benedict

I found an example of a search that implemented it's own search form:

def searchbox(self):
     Make a search box (taken from wikimacro.py)
     @rtype: unicode
     @return: search box html fragment
     _ = self._
     if self.form.has_key('value'):
         default = wikiutil.escape(self.form["value"][0], quote=1)
         default = ''

     button = _("Search Text")

     html = [
         u'<form method="get" action="">',
         u'<input type="hidden" name="action" value="fullfarmsearch">',
         u'<input type="hidden" name="titlesearch" value="fullsearch">',
         u'<input type="text" name="value" size="30" value="%s">' % default,
         u'<input type="submit" value="%s">' % button,
     html = u'\n'.join(html)
     return self.formatter.rawHTML(html)

I then moved most of the code in my macro to an action and it works.


More information about the Moin-user mailing list