ainoy31 Posted September 15, 2008 Share Posted September 15, 2008 Hello- I have a form that allows someone to select a checkbox called "Same as Billing Address". When the box is checked, it calls a javascript function to disabled the other form fields. This is working as designed. The issue that I am dealing with is on the next page. The user might need to come back to the checkbox page and change some of the entered data. I added a back button to allow this. When they click the back button, the checkmark is still on the checkbox "Same as Billing Address" but the form fields are not grayed out or disabled as needed. Should I use the window onload? I hope this is not confusing. Much appreciation. AM Here is the checkbox code: <table border="0" cellpadding="0" cellspacing="0" summary=""> <tr> <td class="Label"><input type="checkbox" name="UBA" id="same_as_billing_address" onClick="javascript: UseBillingAddress();"></td> <td class="Field"><label for="same_as_billing_address"><?=$langContent[$section]['same_as_billing_address'];?></label></td> </tr> <?php foreach($fields as $field) { ?> <?php if($getCustomerRulesAPI->getElement(strtoupper($field) . "_STATUS") != "off") { ?> <tr> <td class="Label"><?php echo $getCustomerRulesAPI->getElement(strtoupper($field) . "_DISPLAY"); ?>:</td> <td class="Field"><?php Here is the javascript: function UseBillingAddress() { if(document.dataForm.UBA.checked) { <?php foreach($fields as $field) { if($getCustomerRulesAPI->getElement(strtoupper($field) . "_STATUS") != "off"){echo 'service_'.$field.' = document.dataForm.'.$field.'.value;'."\n";} if($getCustomerRulesAPI->getElement(strtoupper($field) . "_STATUS") != "off"){echo 'document.dataForm.'.$field.'.value = billing_'.$field.';'."\n";} if($getCustomerRulesAPI->getElement(strtoupper($field) . "_STATUS") != "off"){echo 'document.dataForm.'.$field.'.disabled = true;'."\n";} } echo 'service_region_id = document.dataForm.region_id.value;' . "\n"; echo 'document.dataForm.region_id.value = billing_region_id;' . "\n"; echo 'document.dataForm.region_id.disabled = true;' . "\n"; ?> } else { <?php foreach($fields as $field) { if($getCustomerRulesAPI->getElement(strtoupper($field) . "_STATUS") != "off"){echo 'document.dataForm.'.$field.'.value = service_'.$field.';'."\n";} if($getCustomerRulesAPI->getElement(strtoupper($field) . "_STATUS") != "off"){echo 'document.dataForm.'.$field.'.disabled = false;'."\n";} } echo 'document.dataForm.region_id.value = service_region_id;'."\n"; echo 'document.dataForm.region_id.disabled = false;' . "\n"; ?> } } Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 15, 2008 Share Posted September 15, 2008 The code you provided is of no help. To get help with JavaScript, please post the geneerated HTML code - i.e. not the PHP code. Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted September 15, 2008 Author Share Posted September 15, 2008 The requirement for this feature has changed so this posted topic is not needed anymore. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.