WhyNotDesign.com Home Tab WhyNotDomains.com Home Tab WhyNotDesigns.com Home Tab
WhyNotDesign.com RSS Feed
Why Not Design's Latest Graphics Design

Latest Graphics Design! (2009-07-22)

Sacramento, CA, USA

Enews signup = 20% OFF
Join the Why Not Design e-newsletter & we'll discount your first design purchase.
Get 20% OFF design services!

How to set form field values using JavaScript

Setting form field values from other values with javascript

*** BEFORE you do any of the following, it is ALWAYS a good idea to make a COPY of the file you are going to edit ***

1. The #1 thing you MUST know is that the NAME="yourVariableName" of each form field value you want to use in your script CANNOT contain any of the following or it simply WILL NOT WORK...

  • a hyphen (-)
  • a number (1,2,3,4,5,6,7,8,9,0)
  • an underscore (_)
  • any punctuation (, . ! ? ; : ' etc.)

2. We reccommend you use a naming scheme similar to ours to keep things in order and to make logical sense of your variable names and function names...

  • function names like: doThis(), doThat(), validateThisThing()
  • form field names like: firstName, lastName, myHomeAddress, myCellPhone
  • variable names (if you use them) like: varOne, price, grandTotal, salesTax

3. Here is our sample code

4. Once you have everything in place, it should function like this...

Address #1 :

Use Same Address as above :

Address #2 :

We really hope this has helped SOMEONE :-)

If it has please drop us a note at