Developer Support »

Forcing a visitor to select from a drop-down list, clearing pre-populated values  (See more user questions)

Hi .

Thank you for your purchase. Good to hear from you. If you are
pre-populating the form, you're already doing pretty well!

There isn't much you can do about the previously submitted form values
showing on the form in the case of returning to it. That is down to browser
behaviour and is outwith the control of the script. You might want to do a
little research on page caching and see if you can add some code of your own
to force a refresh every visit, but that said, in the case of simply
returning to the form without clicking a link to do so, it might not
refresh, again down to individual browser behaviour and settings (some
visitors might have their browser set to refresh every time, others won't).

You can make your drop-down list of countries a required field. Your
visitor will then have to select one in order to submit the form. There's
instructions in the script for required fields. If you have a default value
in the list, like "please select" then the script will see this as a
legitimate value, which it is, and will not give an error about the field
being empty. To get around this problem, give the default selection a blank
value, like so:

<option value="">Please Select</option>

Now the default value will be blank and the script will prompt for a vlaue
to be entered (if you have the field set as a required field).

Any questions, just let me know.

Best wishes.

Charles Sweeney
The world's easiest feedback script!

----- Original Message -----
Sent: Friday, May 28, 2010 12:45 PM
Subject: FormToEmail script

> Comments: Hi,
> I purchased the multi user licence the other day. I'm fairly new to php,
> so it's taking me a while. I'm impressed at all instructions good so far,
> many thanks, but two queries:
> I have added the code to clear the form fields when the page is re-visited
> after successful submission (<?php
> if(isset($_SESSION['submitted_form_values'])){unset($_SESSION['submitted_form_values']);}
> ?>
> but it only works when the page is *manually refreshed*, not when the same
> visitor re-visits the page a few minutes later, say. Is this anything to
> do with browser cookies?
> The envelope is NOT xhtml as per your advice:-)
> Also, I have a drop down list of countries on the form. The field is
> obviously pre-populated with that list. Is there any validation code to
> exhort the visitor to select an option other than 'please select' if
> they're lazy or careless(!)
> Any advice much appreciated, I'm struggling , and I pride myself on
> solving this stuff myself but have come to a dead end
> the form address and script is:
> many thanks