[pmwiki-users] Form with specific php validation not returning or retaining previous entrys

Peter Bowers pbowers at pobox.com
Thu Dec 1 12:56:24 CST 2011

On Thu, Dec 1, 2011 at 7:22 PM, John Bowling <johnlb2002 at cox.net> wrote:
> I have a form in pmwiki and created my own validation php to insert the data
> into a pmcal calendar by date, and to email to myself. That part works well.
> The problem lies in data entry errors, where the php detect the problem and
> notifies the user. It cannot return to the page where the form is, and if
> the back button is used, it erases all previous entries.
> How can I make it do both of them?

It's been a while since I worked on forms, but it seems to me I always
submitted forms to themselves.  Then the validation took place before
the page actually showed up (i.e., MyGroup.MyPage.php).  If there was
a problem then I just loaded up $InputValues (see
http://www.pmwiki.org/wiki/Cookbook/InputDefault#values) and perhaps
arranged some PVs or PTVs to display errors or something.  If no
problems then you can either redirect to another page or just do your
calendar writing and show a blank form again...

You might be interested in
http://www.pmwiki.org/wiki/Cookbook/ProcessForm as a *very* simple
example of keeping the values in a form when it is submitted on itself
(also placing some values in PVs).

I'm sure there's some elegant way of doing this without submitting the
form on itself, but this is just how I've always ended up doing it...


More information about the pmwiki-users mailing list