Current time: 08-18-2017, 01:33 AM Hello There, Guest! (LoginRegister)

Post Reply 
09-10-2002, 10:22 AM
Post: #1
I'd llike to create a form that has a "preview" option, before people submit thier form. Is this possible using the regular form html (like dreamhosts formmail)? or do you have to have a special program? does anyone have any suggestions about how to get this feature?
Find all posts by this user
Quote this message in a reply
09-10-2002, 11:32 AM
Post: #2
When someone presses a "submit" button, only the information that is entered into the form is transmitted. The information as to how the page is laid out, what fields were left empty or not checked or not selected, is *not* transmitted.

In theory, I suppose you could have a CGI script that transloads the page that has the form on it in order to build a preview page, but that's an awfully resource-intensive way to do things.

Generally, one writes a script that presents the page. If nothing is transmitted to the script, it presents default values for radiobuttons, etc. If values are transmitted to the page using the "preview" button, the values become the default. If values are tranmitted using the "OK, I like it this way" button, the values are committed.

To tell which button has been pressed, you need to *name* the submit buttons. For instance, if they press the button for <input type="submit" name="preview" value="Let me see how this looks">, your script will get this as a transmitted pair:
preview="Let me see how this looks"

It's not fairly *easy* to do, but probably not a good idea for your first script. Basically, you want to set up the page as an external file or as a HERE document with tokens where each VALUE goes

For text input, use
$page =~ s/NAMEVAL/$namepassed/g;

If you are are doing selects, you need to do a whole series of these:

if ($item3selected ne '')
{$page =~ s/ITEM3SELECTED//;}
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump: