[development] Forms API -- default values without anything in database -- SOLVED

Syscrusher syscrusher at 4th.com
Sat Nov 24 23:53:13 UTC 2007


On Saturday 24 November 2007 18:25, Karoly Negyesi wrote:
> > I am implementing a search function that presents a form
> > allowing users to enter the desired match values, then presents a table with
> > a list of matching records. No problem on any of this.
> 
> I would recommed using form['#redirect'] = FALSE and an #after_build function
> akin to how node previews are done. 

Exactly what I needed! I'd actually already stumbled on the #after_build as I
was looking at node previews for an example. The part I was missing was the
setting of #redirect to FALSE. Thaks very much!

Also thanks to Marco Carbone and David Sterratt (egfrith) for their replies
(the latter off-list), which were also interesting and useful.

The piece that eluded me was that I didn't realize a redirect was being done
even if I didn't return a URL from foo_submit(). It never occurred to me that
it would redirect to itself, thereby losing _POST and all the GLOBALS[...] but
not _GET, because that's of course part of the redirect URL.

It all makes sense now. Thanks again, folks! I will file this thread in my
Drupal reference library.

Kind regards,

Scott

-- 
-------------------------------------------------------------------------------
Syscrusher (Scott Courtney)          Drupal page:   http://drupal.org/user/9184
syscrusher at 4th dot com            Home page:     http://4th.com/   


More information about the development mailing list