Hi Daniël,

Yes, this would be useful, maybe as a standard ns_* style command,
something like an ns_bind_vars.

Right now the focus is on setting up a core AOLserver team, getting
AOLserver 3.5.0 fully documented, getting the current modules cleaned
up/documented, getting AOLserver 4.0 released, and a few other things.
When the majority of that work is done, I think we can look at
improvements to the server and modules such as you've outlined below.

How are your C skills? Your man page creation skills? That’s where we
could use some help right now.


/s.



-----Original Message-----
From: AOLserver Discussion [mailto:AOLSERVER@;LISTSERV.AOL.COM] On Behalf
Of Daniël Mantione
Sent: Monday, November 04, 2002 3:42 PM
To: [EMAIL PROTECTED]
Subject: [AOLSERVER] Input data verification


Hello,

You have propably all build a simple a html form and a
script that processes the form. Now how do you verify your input data?

For example, you want the user to enter a number. How do you verify on
the server side that someone indeed sent a number?

Usually I use the scan command, i.e.:

set r [ns_conn form]
set variabletxt [ns_set iget $r variable]
if {[scan %d $variabletxt variable] == 0} then {
    ns_returnnotfound
    return -code return
} else {
    .....
}

Now this is quite a lot of code for such a simple check and you write it
in each form again. I got a bit bored and wrote a library for it. Now it
is much easier, at the start of a script I just do:

bind_form_vars {mode req num} {actionurl req} {tabledef req} {index num}
{action}

What does this do?

- A form variable "mode" is assigned to the variable "mode". The
variable
  is required ("req") and it must be numeric ("num").
- The form variable "actionurl" is assign to the variable "actionurl"
and
  it is required.
- The same for "tabledef".
- "index" is not required, if it is not present the variable "index"
will
   be set to {}, but if it is present it should be numeric
- "action" is not required

Now, since it is a very basic task that allmost every AOLserver user has
to do, is it perhaps an idea to make such a library part of the standard
AOLserver distribution?

Daniël

Reply via email to