Hi guys,
This is an offtopic post, which I rationalize in the
following ways:
1. I do plan ultimately to write CGIs in Ruby (though
I've done only the most primitive stuff so far)
2. I know this community to be a knowledgeable
and tolerant one
3. I'm atoning by posting a bit of Ruby code
in the next message
My question is:
I've written a primitive CGI or two in the past, which will
accept the data from a form and process it. Usually I
error-check the input and give the user a "go back"
button if it isn't right.
Isn't there a technique for sort of encapsulating the whole
thing, even the initial HTML? (I.e., generate the initial HTML
from the CGI instead of static HTML that points to the
script?)
Something like:
If I have no input, display the blank form
If I have input and the special invisible error fields are
non-null, redisplay the form with the original input and
the error messages
If I have input and all is OK, process the input
I'd like to have a form with three columns (probably use
tables): A column of labels like "Name:"; a column of
text fields; and a column of blank invisible fields that
fill up with ugly red error messages on demand.
What is the general flow of such an animal? Can someone
post a short example in Ruby, say with one or two fields?
I don't know much web stuff, and it always makes my brain
itch until I relearn the basics each time.
Thanks,
Hal