[pmwiki-users] Validating forms in pmwiki

Doug Johnson doug at asknice.com
Mon Jun 22 12:16:54 CDT 2009


My validation is in a separate script...the one that will then do the 
additional work but I prefer doing it as you describe, because I want to 
stay in pmwiki until I get everything verified and done. HoweverI didn't 
find any obvious examples in the online documentation.  If you can point 
me to an example, my validation needs for this page are very simple (are 
three of the fields not blank?) before heading off to the processing script.

I was also thinking of asking for a good starting point for programming 
within pmwiki.  When I started with pmwiki a couple of years ago I 
didn't know my way around PHP, but got pretty good with straight up 
pmwiki.  Now I have better PHP chops, so I'm trying to figure out where, 
if anywhere, one begins to get good at extending pmwiki within the 
bounds of "how things are done here".
Doug

Peter Bowers wrote:
> On Sun, Jun 21, 2009 at 1:59 PM, Doug Johnson <doug at asknice.com 
> <mailto: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

-- 
Doug Johnson
"When people start being nice to me, I just know it's going to hurt." - 
Morrie 
216-502-3372 Direct voice
602-865-7041 Direct eFax
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090622/665e8d8d/attachment.html 


More information about the pmwiki-users mailing list