[pmwiki-users] foxaction replace

Hans design5 at softflow.co.uk
Tue Mar 25 04:02:12 CDT 2008


Tuesday, March 25, 2008, 4:39:00 AM, adam overton wrote:

> well, i decided that i'd like for the user to only be able to input  
> one email address total - and that any further form submissions would
> replace the original content. here's what i thought would work

> instead of
> (:fox addemail target="FoxNotifyLists.{*$Group}":)
> i put this as the top of the form:
> (:fox addemail foxaction=replace put=overwrite target="FoxNotifyLists.
> {*$Group}":)

> but this doesn't seem to work - nothing gets added, nothing gets  
> replaced.

Generally put a (:foxmessages:) markup on your form page, to get any
feedback from error messages. This works apart from when you use the
redirect=  option.

I suspect you may not have permission to replace on the target page.

But foxaction=replace put=overwrite is not a good idea, as it will
replace all content on the target with the new content posted.
So unless you use the fox form as an edit form and input all the
existing content into a textarea control (or other form controls),
you will loose data.

What you really need is a verification on submission to see if the
email adress exists already, and allow adding only if it doesn't.

For validation you can use this in your form:

(:foxcheck email if="intext {$$name} PageName" ... :)

where' email' is the input field name and 'PageName' the name of the
page which holds a list of email address strings.
You find a definition for the custom intext conditional markup here:
http://www.pmwiki.org/wiki/Cookbook/ConditionalMarkupSamples

If page PageName needs to be read protected you may need to change the
intext function to allow for reading the page content even if a user
has no read access (use 'ALWAYS' instead of 'read' in RetrieveAuthPage
or use ReadPage)


  ~Hans




More information about the pmwiki-users mailing list