I cannot get the value of a form element, even though from other similar questions this is supposed to work.
FYI - I have a function that writes 2 id's (#selected_sign & #selected_sign_form) to an article and a form nested in the article - this is purely for styling/identification purposes.
Here is the function that fails to get the element value based on the assigned IDs:
var sSize_prices= new Array();
sSize_prices["45"]=45; //per sq ft
sSize_prices["60"]=65; //per sq ft
function getSizePrice() {
var getSizePrice=0;
var theForm = document.forms["selected_sign_form"];
var selectedSize = theForm.elements["os0"];
alert(selectedSize.value);
getSizePrice = sSize_prices[selectedSize.value];
return getSizePrice;
}
Here is the HTML markup containing the ID'd article and form:
<section class="sign_type">
<h3>Selection</h3>
<article class="signs" onclick="calculateTotal()" id="selected_sign">
<figure class="sample">
<a href="/cat/s1b.png" rel="lightbox" title="Sign preview">
<img class="sign_preview" src="/cat/s1.png" alt="Sign preview" title="Sign preview" />
</a>
</figure>
<form action="" class="options" onsubmit="return false;" id="selected_sign_form">
<div class="sign_option1"><label class="on0">Size:</label>
<select name="Size" class="os0" onclick="calculateTotal()">
<option value="45">45cm sq</option>
<option value="60">60cm sq</option>
</select>
</div>
<div class="sign_option2"><label class="on1">Qty:</label>
<input name="Quantity" class="os1" value="1" onkeyup="calculateTotal()" />
</div>
<div class="sign_option3"><label class="on2">Fine:</label>
<input name="Custom" class="os2" value="" />
</div>
</form>
<div class="price"></div>
</article>
</section>