[pmwiki-users] Validating forms in pmwiki
Peter Bowers
pbowers at pobox.com
Mon Jun 22 09:54:30 CDT 2009
On Sun, Jun 21, 2009 at 1:59 PM, Doug Johnson <doug at asknice.com> wrote:
> I've read through a lot of the online documentation. I've got my form
> done and it is lovely.
> I am following the advice to do validation server side. I am calling a php
> program that does the validation and then will pass the entered data
> elsewhere.
> My problem is that I can't see how to go back to the calling page if the
> data doesn't validate. According to me, it would be a post back to the
> pmwiki page with all of the passed variables going back in fields and then
> reading from the $_SESSION vars (which I have working fine, thank you).
> But I don't know how to do the post back to the page without loading up a
> form and requiring the user to click on it.
>
It sounds like you have your validation in a standalone script rather than
something integrated into pmwiki. Typically the way this is handled is by
integrating your validation script with pmwiki via a custom action
(?action=myvalidatingaction) or via some sort of markup located on a given
page. Then your form has a target URL which specifies this action or the
appropriate page.
Doing it as a markup has the advantage that you can place your error
messages on your page without having to modify any code.
Submitting to the *same* page where your form is located ({$FullName}) has
the advantage of making it very easy to leave your fields filled in if the
user made a mistake and they need to edit a field or two...
In your validation script if everything looks good then you can store your
data appropriately and simply redirect to another page.
I don't know if that helps or not... The important point is that life will
be a lot easier working within pmwiki rather than working independently and
trying to pass stuff back and forth via $_SESSION (typically $_SESSION is
not used at all in forms).
-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090622/75cc6adb/attachment.html
More information about the pmwiki-users
mailing list