[thelist] retaining values in forms while alerting use mistakes

Nan Harbison nan at nanharbison.com
Mon Jul 9 12:49:13 CDT 2007


I was just doing this with html, maybe that is one of the problems, that I
should do the whole form in PHP?

On this form, users are filling out this form to sign up for a service.
Although, eventually, after I get this working, it will be grabbing data
from a db for users to update their profile or make changes.

Thanks for this.

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Anthony Baratta
Sent: Monday, July 09, 2007 1:44 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] retaining values in forms while alerting use mistakes


How are you building your select boxes? Is the data coming out of a
Database? Is it "Static"?

Either way - you should create a function to build the select box for you.
Within that function, test for the post value and set the selected state

e.g. pseudo-code...

function buildSelect(sName, arrayOfData, sSelectedValue)
   echo "<select name='" + sName + "' id='" + sName + "'>";
   for each datePoint in arrayOfData
     echo <option value='" + datePoint  + "';
     if sSelectedValue == datePoint then
            echo " selected";
     end if
     echo ">" + datePoint + "</option>";
   echo "</select>"
end function

Or something close to that.

-----Original message-----
From: "Nan Harbison" nan at nanharbison.com
Date: Mon, 09 Jul 2007 10:16:10 -0700
To: thelist at lists.evolt.org
Subject: [thelist] retaining values in forms while alerting use mistakes

> I have googled myself silly, and have tried a bunch of ways to 
> maintain the values of checkboxes and drop down boxes when the user 
> makes a mistake. Of course, text boxes are easy.


* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 

More information about the thelist mailing list