yes i am using the right id for all of them. here is the complete
<?php
/**
* @package HikaShop for Joomla!
* @version 1.5.1
* @author hikashop.com
* @copyright (C) 2010-2011 HIKARI SOFTWARE. All rights reserved.
* @license http://www.hikashop.com/commercial_license.php
*/
defined('_JEXEC') or die('Restricted access');
$choice=0;
$choice = $_SESSION['choice'];
echo $choice;
?>
<?php
$js = "
<!--
function hikashopHandleCases(obj){
var doextra = false;
if(obj.name=='data[order][user_choice]'){
doextra =true;
var hide = new Array();
var show = new Array();
if(obj.id=='user_choice_activate_both'){
show.push('numberchoice')
hide.push('customtext_173_13_32_23');
hide.push('accountname');
hide.push('billingaddress');
hide.push('phone_number');
hide.push('carrier');
hide.push('account_number');
hide.push('pin');
hide.push('ssn');
hide.push('esnnumber');
hide.push('mobile_serial_lock_code');
hide.push('iqaccount');
}else if(obj.id=='user_choice_activate_plan_other_phone'){
show.push('numberchoice')
hide.push('customtext_173_13_32_23');
hide.push('accountname');
hide.push('billingaddress');
hide.push('phone_number');
hide.push('carrier');
hide.push('account_number');
hide.push('pin');
hide.push('ssn');
show.push('esnnumber');
show.push('mobile_serial_lock_code');
hide.push('iqaccount');
}else if(obj.id=='user_choice_activate_plan_iq_phone'){
doextra = false;
hide.push('numberchoice')
hide.push('customtext_173_13_32_23');
hide.push('accountname');
hide.push('billingaddress');
hide.push('phone_number');
hide.push('carrier');
hide.push('account_number');
hide.push('pin');
hide.push('ssn');
hide.push('esnnumber');
hide.push('mobile_serial_lock_code');
show.push('iqaccount');
}
else if(obj.id=='user_choice_activate_phone'){
doextra = false;
hide.push('numberchoice')
hide.push('customtext_173_13_32_23');
hide.push('accountname');
hide.push('billingaddress');
hide.push('phone_number');
hide.push('carrier');
hide.push('account_number');
hide.push('pin');
hide.push('ssn');
hide.push('esnnumber');
hide.push('mobile_serial_lock_code');
show.push('iqaccount');
}
}
else if(obj.name=='data[order][numberchoice]'){
var hide = new Array();
var show = new Array();
if(obj.id=='numberchoice_keepnumber'){
show.push('customtext_173_13_32_23');
show.push('accountname');
show.push('billingaddress');
show.push('phone_number');
show.push('carrier');
show.push('account_number');
show.push('pin');
show.push('ssn');
}
else if(obj.id=='numberchoice_newnumber'){
hide.push('customtext_173_13_32_23');
hide.push('accountname');
hide.push('billingaddress');
hide.push('phone_number');
hide.push('carrier');
hide.push('account_number');
hide.push('pin');
hide.push('ssn');
}
}
switchFields(show,hide);
if(doextra){
var keepnumber = document.getElementById('numberchoice_keepnumber');
if(keepnumber.checked){
hikashopHandleCases(keepnumber);
}
}
}
function switchFields(show,hide){
for(var i=0;i<show.length;i++){
var found = hikashopGetElementsByClass('hikashop_checkout_'+show[i]+'_line',document,'tr');
for(var k=0; k<found.length;k++){
found[k].style.display = '';
}
}
for(var j=0;j<hide.length;j++){
var found2 = hikashopGetElementsByClass('hikashop_checkout_'+hide[j]+'_line',document,'tr');
for(var l=0; l<found2.length;l++){ found2[l].style.display = 'none'; }
}
}
function hikashopGetElementsByClass( searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = \" \"+searchClass+\" \";
for(i=0,j=0; i<tags.length; i++) {
var test = \" \" + tags[i].className + \" \";
if (test.indexOf(tcl) != -1)
el[j++] = tags[i];
}
return el;
}
do_nothing( function(){
var elements = document.getElementsByName(\"data[order][user_choice]\");
for(var i=0,j=0; i<elements.length; i++) {
if(elements[i].checked){
document.elements[1].checked = true;
hikashopHandleCases(elements[i]);
}
}
});
-->
if(".$choice."!=0)
var elements = document.getElementsByName(\"data[order][user_choice]\");
{
if(".$choice."==1){
var choice1 = document.getElementById('user_choice_activate_both');
choice1.checked=true;}
else if(".$choice."==2){
var choice2 = document.getElementById('user_choice_activate_plan_other_phone');
choice2.checked=true;}
else if(".$choice."==3){
var choice3 = document.getElementById('user_choice_activate_plan_iq_phone');
choice3.checked=true;}
else{}
}
";
$doc =& JFactory::getDocument();
$doc->addScriptDeclaration($js);
$type = $this->type;
foreach($this->extraFields[$type] as $fieldName => $oneExtraField) { $css='';
if($fieldName!='fake'){
$css = 'style="display:none;"';
}
?>
<tr class="hikashop_checkout_<?php echo $fieldName;?>_line" <?php echo $css; ?>>
<td class="key">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</td>
<td>
<?php
echo $this->fieldsClass->display($oneExtraField,$this->$type->$fieldName,'data['.$type.']['.$fieldName.']', false, 'onclick=" hikashopHandleCases(this);"');
?>
</td>
</tr>
<?php }
?>
here is the complete html code of the step 2 where it should all be working.
<fieldset class="input">
<legend>Additional information</legend>
2
<table cellspacing="0" cellpadding="0" border="0" class="hikashop_contentpane"><tbody><tr style="display:none;" class="hikashop_checkout_user_choice_line">
<td class="key">
<label for="user_choice">I want to</label> </td>
<td>
<input type="radio" onclick=" hikashopHandleCases(this);" id="user_choice_activate_both" value="activate_both" name="data[order][user_choice]"><label for="user_choice_activate_both">Activate iQ Phone and Plan.</label><input type="radio" onclick=" hikashopHandleCases(this);" id="user_choice_activate_plan_other_phone" value="activate_plan_other_phone" name="data[order][user_choice]"><label for="user_choice_activate_plan_other_phone">Activate iQ Plan on existing phone.</label><input type="radio" onclick=" hikashopHandleCases(this);" id="user_choice_activate_plan_iq_phone" value="activate_plan_iq_phone" name="data[order][user_choice]"><label for="user_choice_activate_plan_iq_phone">Upgrade iQ Plan only</label><input type="radio" onclick=" hikashopHandleCases(this);" id="user_choice_activate_phone" value="activate_phone" name="data[order][user_choice]"><label for="user_choice_activate_phone">Upgrade iQ Phone on existing plan</label> <span class="hikashop_field_required">*</span> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_numberchoice_line">
<td class="key">
<label for="numberchoice">I would like</label> </td>
<td>
<input type="radio" onclick=" hikashopHandleCases(this);" id="numberchoice_newnumber" value="newnumber" name="data[order][numberchoice]"><label for="numberchoice_newnumber">A new number</label><input type="radio" onclick=" hikashopHandleCases(this);" id="numberchoice_keepnumber" value="keepnumber" name="data[order][numberchoice]"><label for="numberchoice_keepnumber">To activate using my existing Phone number</label> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_customtext_173_13_32_23_line">
<td class="key">
<label for="customtext_173_13_32_23">Keep Your Number</label> </td>
<td>
To Keep Your Current Phone Number, Please provide information below. <br><a href="https://www.iqcellular.com/index.php/component/content/article/7-iq/28-activation-information" class="jcepopup" type="text/html" rel="">Help<span class="jcemediabox-zoom-link"></span></a> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_mobile_serial_lock_code_line">
<td class="key">
<label for="mobile_serial_lock_code">MSL</label> </td>
<td>
<input type="text" value="" name="data[order][mobile_serial_lock_code]" onclick=" hikashopHandleCases(this);" id="mobile_serial_lock_code" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_esnnumber_line">
<td class="key">
<label for="esnnumber">ESN</label> </td>
<td>
<input type="text" value="" name="data[order][esnnumber]" onclick=" hikashopHandleCases(this);" id="esnnumber" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_phone_number_line">
<td class="key">
<label for="phone_number">Phone #</label> </td>
<td>
<input type="text" value="" name="data[order][phone_number]" onclick=" hikashopHandleCases(this);" id="phone_number" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_carrier_line">
<td class="key">
<label for="carrier">Carrier</label> </td>
<td>
<input type="text" value="" name="data[order][carrier]" onclick=" hikashopHandleCases(this);" id="carrier" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_account_number_line">
<td class="key">
<label for="account_number">Account #</label> </td>
<td>
<input type="text" value="" name="data[order][account_number]" onclick=" hikashopHandleCases(this);" id="account_number" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_pin_line">
<td class="key">
<label for="pin">Pin #</label> </td>
<td>
<input type="text" value="" name="data[order][pin]" onclick=" hikashopHandleCases(this);" id="pin" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_ssn_line">
<td class="key">
<label for="ssn">SSN #</label> </td>
<td>
<input type="text" value="" name="data[order][ssn]" onclick=" hikashopHandleCases(this);" id="ssn" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_accountname_line">
<td class="key">
<label for="accountname">Account Name</label> </td>
<td>
<input type="text" value="" name="data[order][accountname]" onclick=" hikashopHandleCases(this);" id="accountname" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_billingaddress_line">
<td class="key">
<label for="billingaddress">Billing Address</label> </td>
<td>
<input type="text" value="Address, City, State, Zip" name="data[order][billingaddress]" onclick=" hikashopHandleCases(this);" id="billingaddress" class="inputbox"> </td>
</tr>
<tr style="display:none;" class="hikashop_checkout_iqaccount_line">
<td class="key">
<label for="iqaccount">iQ Account (Phone Number)</label> </td>
<td>
<input type="text" value="" name="data[order][iqaccount]" onclick=" hikashopHandleCases(this);" id="iqaccount" class="inputbox"> </td>
</tr>
</tbody></table>
</fieldset>
i tried many different ways to get the raido obj in the var.
the only place i didn't get a error was using the code below. This is only way i got it to go through but again nothing was triggered to show.. would this have something to do with the fact that it's being trigger by a onclick? even if i get it to automatically select the radio button in the background will it trigger the rest of the functions?
do_nothing( function(){
var elements = document.getElementsByName(\"data[order][user_choice]\");
for(var i=0,j=0; i<elements.length; i++) {
if(elements[i].checked){
document.elements[1].checked = true;
hikashopHandleCases(elements[i]);
}
}
})
Thanks again