[pmwiki-users] Advanced Search Form with Fox

Hans design5 at softflow.co.uk
Thu Dec 11 05:34:32 CST 2008


Thursday, December 4, 2008, 5:12:27 PM, noskule wrote:

> It works with fox, A user can set some form fileds. By form submission the form
> adds the field values as post vars to the url. Post vars gets transformed to
> page variables. Then a pagelist set by pagevariables displays the results.

> The troulbe is, that it is possible to check more than one pagetype but only
> the last one gets acctually submitted. Example if i check "Blog" and 
> "Comments" only Comments apears in the url:
>     ...&pagetype=Comments
> instead of:
>     ...&pagetype=Blog,Comments

try your form with something along these lines (I changed some var
names and simplified the form to make my life easier):

%red%(:foxmessages:)
(:fox pagelistconfig target={*$FullName} foxtemplate="" redirect={*$FullName}?pagetype={$$pagetype}:)
Pagetypes:\\
(:input hidden pagetype {$pagetype[]}:)
||
||Article ||(:input checkbox pagetype[] Article:) ||
||Blog ||(:input checkbox pagetype[] Blog:) ||
||Issue ||(:input checkbox pagetype[] Issue:) ||
||Comment ||(:input checkbox pagetype[] Comment:) ||

(:input submit post:)
(:foxend pagelistconfig:)

NOTEs:
The checkbox field is set as an array using the name[] syntax.
Fox converts the submitted values into a comma-separated list.
The hidden field sets another var to this.
The target and template parameters seem necessary.
Always add a (:foxmessages:) markup to catch errors, and disable the
redirect temporarily.
For advanced trouble shooting set in fox.php $FoxDebug = 4; or so, to
get an echoed list of parameters etc.



  ~Hans




More information about the pmwiki-users mailing list