Forums

bvivante 31 Oct, 2012
I upgraded to the latest version of Chrono Forms for Joomla 1.5 and now my javascript that was in the code box in previous version won't run?

<script type="text/javascript"> 
function addit(){ 
    if(document.getElementById("paymentAmount").value=="15") 
    { 
        document.getElementById("cde-Quan-0").value="1 Death Certificate" 
    } 
    if(document.getElementById("paymentAmount").value=="30") 
    { 
        document.getElementById("cde-Quan-0").value="2 Death Certificates" 
    } 
    if(document.getElementById("paymentAmount").value=="45") 
    { 
        document.getElementById("cde-Quan-0").value="3 Death Certificates" 
    } 
	  if(document.getElementById("paymentAmount").value=="60") 
    { 
        document.getElementById("cde-Quan-0").value="4 Death Certificates" 
    } 
	  if(document.getElementById("paymentAmount").value=="75") 
    { 
        document.getElementById("cde-Quan-0").value="5 Death Certificates" 
    } 
	  if(document.getElementById("paymentAmount").value=="90") 
    { 
        document.getElementById("cde-Quan-0").value="6 Death Certificates" 
    } 
	  if(document.getElementById("paymentAmount").value=="105") 
    { 
        document.getElementById("cde-Quan-0").value="7 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="120") 
    { 
        document.getElementById("cde-Quan-0").value="8 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="135") 
    { 
        document.getElementById("cde-Quan-0").value="9 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="150") 
    { 
        document.getElementById("cde-Quan-0").value="10 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="165") 
    { 
        document.getElementById("cde-Quan-0").value="11 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="180") 
    { 
        document.getElementById("cde-Quan-0").value="12 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="195") 
    { 
        document.getElementById("cde-Quan-0").value="13 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="210") 
    { 
        document.getElementById("cde-Quan-0").value="14 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="225") 
    { 
        document.getElementById("cde-Quan-0").value="15 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="240") 
    { 
        document.getElementById("cde-Quan-0").value="16 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="255") 
    { 
        document.getElementById("cde-Quan-0").value="17 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="270") 
    { 
        document.getElementById("cde-Quan-0").value="18 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="285") 
    { 
        document.getElementById("cde-Quan-0").value="19 Death Certificates" 
    } 
		  if(document.getElementById("paymentAmount").value=="300") 
    { 
        document.getElementById("cde-Quan-0").value="20 Death Certificates" 
    } 
} 
</script>
<input type="hidden" name="productId" value="numeric-value-from-my-processor">
<div class="ccms_form_element cfdiv_header" id="1_container_div" style=""><p>Death Certificate - Express Mail - $15 added for Express Postage</p><div class="clear"></div></div><div class="ccms_form_element cfdiv_select" id="paymentamount1_container_div" style=""><label>Number of Certificates</label>
<select name="paymentAmount" id="paymentAmount" onChange="addit()">
<option value="Choose Number of Certificates" selected="selected">Choose Number of Certificates</option>
<option value="30">1 - $30</option>
<option value="45">2 - $45</option>
<option value="60">3 - $60</option>
<option value="75">4 - $75</option>
<option value="90">5 - $90</option>
<option value="105">6 - $105</option>
<option value="120">7 - $120</option>
<option value="135">8 - $135</option>
<option value="150">9 - $150</option>
<option value="165">10 - $165</option>
<option value="180">11 - $180</option>
<option value="195">12 - $195</option>
<option value="210">13 - $210</option>
<option value="225">14 - $225</option>
<option value="240">15 - $240</option>
<option value="255">16 - $255</option>
<option value="270">17 - $270</option>
<option value="285">18 - $285</option>
<option value="300">19 - $300</option>
<option value="315">20 - $315</option>
</select>
<div class="clear"></div><div id="error-message-paymentAmount"></div></div><div class="ccms_form_element cfdiv_text" id="cde_dateof_31_container_div" style=""><label>*Date of Death</label><input maxlength="150" size="30" class=" validate['required']" title="" type="text" value="" name="cde-Dateof-3" />
<div class="clear"></div><div id="error-message-cde-Dateof-3"></div></div><div class="ccms_form_element cfdiv_text" id="cde_fullname_21_container_div" style=""><label>*Full Name of Decedent </label><input maxlength="150" size="30" class=" validate['required']" title="" type="text" value="" name="cde-FullName-2" />
<div class="clear"></div><div id="error-message-cde-FullName-2"></div></div><div class="ccms_form_element cfdiv_text" id="cde_mothmaid_41_container_div" style=""><label>*Mothers Maiden Name</label><input maxlength="150" size="30" class=" validate['required']" title="" type="text" value="" name="cde-MothMaid-4" />
<div class="clear"></div><div id="error-message-cde-MothMaid-4"></div></div><div class="ccms_form_element cfdiv_text" id="cde_locaof_31_container_div" style=""><label>Location of Death</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="cde-Locaof-3" />
<div class="clear"></div><div id="error-message-cde-Locaof-3"></div></div><div class="ccms_form_element cfdiv_submit" id="input_submit_71_container_div" style="text-align:left"><input name="input_submit_7" class="" value="Submit" type="submit" />
<div class="clear"></div><div id="error-message-input_submit_7"></div></div><div class="ccms_form_element cfdiv_header" id="2_container_div" style=""><p>* = indicates required Field</p><div class="clear"></div></div>
GreyHead 31 Oct, 2012
Hi bvivante,

TypeError: document.getElementById("cde-Quan-0") is null


You don't appear to have an element with this id in the form. If I add one then it is updated correctly.

Bob
bvivante 31 Oct, 2012
Thanks, that's excellent, I didn't even need to rework my forms from a much older version!
This topic is locked and no more replies can be posted.