Solved

javascript / firefox issue setting form values

Posted on 2011-02-20
2
316 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
Comment Utility
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
Comment Utility
second one worked like a charm !

Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

744 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

17 Experts available now in Live!

Get 1:1 Help Now