Solved

Undefined Value in Mozilla

Posted on 2008-11-02
4
309 Views
Last Modified: 2012-06-22
We have a small store on our website. When an item is selected values are set in a PayPal form and then submitted to PayPal. I thought I had it working in IE, Safari and Mozilla, but when retesting this afternoon, I find I'm getting an error in Mozilla. Here is an item description:

      <div id="optionalText"></div>
      <div id="itemMain">
        <div id="itemName">White Lightning Flash Cap</div>
        <div id="itemImage"><img src="../../../assets/images/store/hats/lightCap.jpg" alt="White Lightning Flash Cap" width="226" height="151" /></div>
        <div id="itemDescription"><br />
          Unstructured, low profile, six panel, soft mesh, back cap. <br />
          <br />
          Padded sweatband. <br />
          <br />
          Adjustable self-fabric closure with sliding silver buckle. <br />
          <br />
          Color: putty/black.</div>
        <div id="itemAttributes">
          <div id="attribute">
          </div>
        </div>
      </div>
      <div id="order">
        <div id="itemOrder">
          <div id="costShip">
            <div id="price"> <strong>Price:</strong> $20.00 </div>
            <div id="shipping"> <strong>Shipping</strong>: $3.00 </div>
          </div>
          <div id="order">
            <div id="nbrItems">
              <label><strong>Quantity:</strong></span>
              <select name="quantity1" id="quantity1">
                <option value="1" selected="selected">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
                <option value="6">6</option>
                <option value="7">7</option>
                <option value="8">8</option>
                <option value="9">9</option>
                <option value="10">10</option>
              </select>
              </label>
            </div>
            <div id="addtoCart">
              <input name="addCart1" type="submit" id="addCart1" onclick="MM_callJS('ppsubmit(\&quot;lightHat\&quot;)')" value="Add to Cart" />
            </div>
          </div>
        </div>
      </div>
Here is the validation code:

<script type="text/javascript" language="JavaScript">
var amtsave;
var shipsave;
var qtysave;

function ppsubmit(product)
{
      switch(product)
      {
      case "lightHat":
                        amtsave="20.00";
                        shipsave="3.00";
                        qtysave=quantity1.value;
                        document.paypalform.item_name.value="White Lightning Flash Cap";
      if (qtysave == "1")
            {
            document.paypalform.shipping.value=shipsave;
            document.paypalform.quantity.value=qtysave;
            }
            else
            {
             document.paypalform.shipping.value=shipsave*qtysave;
             document.paypalform.quantity.value=qtysave;
            }
            document.paypalform.amount.value=amtsave;
            document.paypalform.submit();
}
Mozilla is issuing an error saying "quantity1" is undefined. Any ideas how it wants a list/menu value defined?
0
Comment
Question by:slegy
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
LordOfPorts earned 500 total points
ID: 22863642
Try:

qtysave = document.getElementById('quantity1').value;

instead of:

qtysave=quantity1.value;
0
 

Author Comment

by:slegy
ID: 22863875
It works great - thank you! One last question - this should be simple:

I'm trying to concatenate color, item description and size:
document.paypalform.item_name.value=document.getElementById('color1').value;+" Lightning Polo Shirt";
The "Lightning Polo Shirt" is being ignored. Any idea why?
0
 
LVL 19

Expert Comment

by:LordOfPorts
ID: 22863943
The semi-colon after .value should be removed, then it should work:
document.paypalform.item_name.value = document.getElementById('color1').value + " Lightning Polo Shirt";

Open in new window

0
 

Author Closing Comment

by:slegy
ID: 31512547
Everything is working great! Now we know why the store in the current site has never worked in Mozilla. Thank you so very much.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Define alias for servlet 5 41
excpetion with multiple catch 11 105
pay per click 3 132
Error handling in PHP 5 51
New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

743 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

12 Experts available now in Live!

Get 1:1 Help Now