[pmwiki-users] Javascript on a single page

Patrick R. Michaud pmichaud at pobox.com
Thu Feb 2 11:22:57 CST 2006


On Thu, Feb 02, 2006 at 12:54:42PM +0100, kirpi at kirpi.it wrote:
> > What sort of form validation are you wanting to do...?
> 
> Nothing more than the usual ones, actually.
> Imagine a simple contact form, or an order form.
> At times you want some field not to left empty, or want to force some
> entry to be numeral, and/or not zero, and/or not more/less than an
> certain amount, or just want to check for the email address to be
> formally correct.
> I usually set form validation both at the server side and as a
> javascript on the client side.

Well, any form validation performed only on the client side
can always be bypassed, so it's almost always necessary to
also have it on the server side.  For this reason, most sites
I've dealt with have always just used server-side validation.

The main feature of client-side validation is that it can help
a client formulate a valid request before it goes to the server.
But it doesn't prevent invalid requests from reaching the server.  :-)

Sounds like an extension of some sort to me -- i.e., we could
create markups such as

   (:input email:)
   (:input number:)
   (:input text required=yes:)

and it would generate form controls with the appropriate client-side
validation scripts in place.  It would also require overloading
the (:input submit:) markup, so that the form controls could be
validated prior to the form being submitted.

But this definitely sounds like something for the Cookbook to me.
At any rate, PmWiki offers sufficient "hooks" for it to be done
as a recipe.

Pm




More information about the pmwiki-users mailing list