Solved

javascript / firefox issue setting form values

Posted on 2011-02-20
2
317 Views
Last Modified: 2012-05-11
I am currently using: productInfo.elements["productId"].value = myProductId;

productInfo as the form name, in IE it works but not firefox, firefox give me error: productInfo is not defined

does some know how I can fix this so it works with all browsers
0
Comment
Question by:prowebinteractiveinc
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34939375
try : document.forms["productInfo"].elements["productId"].value = myProductId;

or if you set the id attribute of your form : document.getElementById("productInfo").elements["productId"].value = myProductId;

or if you set the id attribute of your product (name productId) :  document.getElementById("productId").value =  myProductId;
0
 

Author Closing Comment

by:prowebinteractiveinc
ID: 34939634
second one worked like a charm !

Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now