Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® Links


Thread Tools Search this Thread Display Modes
Old May 11th, 2010, 05:18 AM
EricC EricC is offline
Regular Contributor
Join Date: Nov 2008
Posts: 87
Talking Quick questions regarding JavaScript Examples

I downloaded the 'AcmeCorp' zip file from this forum (the 'blue' version by Mark H, which shows how you can redirect the user to one of four 'thankyou' pages, depending on which radio button the user selected)

A few questions regarding the html/JavaScript code:

In the form, the text boxes are coded like this:
<input name="lastname" id="lastname" type="text" value="%%LastName%%" />

1. What is the difference between 'name' and 'id'?

2. Are both necessary?

3. Which one matters to the JavaScript code? (I'm assuming 'ID' since the JavaScript Function is called 'getElementById' but I just want to be sure)

In the redirect code, which looks like this:
window.location = redirectPage + "?firstName=" + firstName + "&interest=" + interest;

Just to help me understand:
4. 'firstName' refers to the variable, not the actual textbox ID or Name ... is this correct? (This makes sense, and I also notice the upper case 'N')

Thank you!
Eric Carbone
IT/Project Manager, MOR Printing Inc.

Windows 10 |Adobe Acrobat XI | FusionPro 9
Reply With Quote
Old May 11th, 2010, 09:44 AM
FreightTrain's Avatar
FreightTrain FreightTrain is offline
Learning Development Manager
Join Date: Oct 2008
Location: Solana Beach, CA
Posts: 326
Default Re: Quick questions regarding JavaScript Examples

1) Both the Name and ID value should be the same whenever possible. They are used to name the <form> tag itself and the individual fields within it.

2) There is some overlap between the usage of Name and ID, so they are typically named the same, but YES, every form field should have a Name and ID attribute.

For Check boxes and Radio buttons the Name and ID values may actually have to be different because they are unique as you can only choose one. Although Check boxes may allow you to check more than one.

3) The main duty of the ID is for CSS and JavaScript usage, while the Name is used more for the HTML, CGI script and JavaScript.

4) redirectPage is the html page assigned to the variable
"?firstName=" is part of the query string in the function to get the firstname
firstname = is the variable from the form on the Index page
"&interest=" = is part of the query string in the function to get the interest from the radio button
interest = is the interest selected from the variable in the form and helps define the redirect

Hope this helps
Richard A. Lewis, Jr.
Learning Development Manager | MarcomCentral® a Ricoh Company
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 12:30 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.