Jump to content

[SOLVED] Re-use Code


ainoy31

Recommended Posts

Hello-

 

I have a form with 4 radio buttons where people can choose what they want to do.  Base on what they select, I display the questions.  The 4 options uses almost the same questions except 2 or 3 here and there.  I decided to put the questions in a separate function.  Once an option has been picked, the question function gets called.  Here is the code that does this:

<input type="radio" name="shipment_type" value="air" onClick="hideAll(); changeDiv('air', 'block'); ">AIR

<input type="radio" name="shipment_type" value="lcl" onClick="hideAll(); changeDiv('lcl', 'block'); ">LCL

<input type="radio" name="shipment_type" value="fcl" onClick="hideAll(); changeDiv('fcl', 'block'); ">FCL

<input type="radio" name="shipment_type" value="truck" onClick="hideAll(); changeDiv('truck', 'block'); ">TRUCK

 

<div id="lcl" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

<div id="lcl" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

<div id="fcl" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

<div id="truck" style="display:none;">

<? echo cal_dim(); ?>

</div>

 

It does displays the questions for each options picked but the problem is that none of the calculation fields work.  Now, if I remove the echo cal_dim() away except for one option, then it works.  Seems like I can not  have all the options calling cal_dim() at the same time.  Can my javascript cause this issue?  All of my calculation fields uses javascript.  I hope this is clear enough to understand.  Much appreciation.  AM

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.