www.webdeveloper.com
Results 1 to 4 of 4

Thread: Help me with my java code. (desperate) lol.

  1. #1
    Join Date
    Sep 2011
    Posts
    4

    Unhappy Help me with my java code. (desperate) lol.

    this is the website:

    http://qodeplay.com/opencart_v1.5.1....count/register

    Everything else that is java is working fine on the website, but the checkbox that asks if i have a global account number, doesnt.


    this is my code so far, if you see a mistake in there please help me out, i need this done as soon as possible and i have tried everything!









    Code:
    <?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
    <div id="content"><?php echo $content_top; ?>
      <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
      </div>
      <h1><?php echo $heading_title; ?></h1>
      <?php if ($error_warning) { ?>
      <div class="warning"><?php echo $error_warning; ?></div>
      <?php } ?>
      <p><?php echo $text_account_already; ?></p>
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="register">
        
        <h2><?php echo "Your Company Details"; ?> </h2>
        <div class="content">
          <table class="form" >
           <tr>
              <td><?php echo $entry_company; ?></td>
              <td><input type="text" name="company" value="<?php echo $company; ?>" /></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo "ABN:"; ?></td>
              <td><input type="text" name="address_1" value="<?php echo $address_1; ?>" />
                <?php if ($error_address_1) { ?>
                <span class="error"><?php echo $error_address_1; ?></span>
                <?php } ?></td>
            </tr>
            
            
            
            
            
            
            <script type="text/javascript">
    function makeChoice()
    {
    var val = 0;
    for( i = 0; i < document.form1.accno.length; i++ )
    {
    if( document.form1.accno[i].checked == true )
    {
    val = document.form1.accno[i].value;
    if(val=='cedu')
    {
    document.form1.otherChoice.disabled=false;
    document.form1.otherChoice.focus();
    }
    else
    {
    document.form1.otherChoice.disabled=true;
    }
    }
    }
    }
    </script>
    
    
    
    <body onload="document.form1.otherChoice.disabled=true">
    
    
    
    
    <form name="form1" action="#" method="post">
    <tr>
    <td>Do you have an Account with us already?<br /><br /><i>If yes, please enter your global account number <u>below<u/>.</i></td>
    <td>
    <input type="radio" name="accno" value="1" onclick="makeChoice();" />
    Yes
    <input type="radio" name="accno" value="cedu" onclick="makeChoice();"/>
    No
    </td>
    </tr>
    <tr>
    <td>Global Account Number:</td>
    <td><input type="text" name="otherChoice" />
    </td>
    </tr>
    </form>
      <tr>
              <td><?php echo $entry_address_2; ?></td>
              <td><input type="text" name="address_2" value="<?php echo $address_2; ?>" /></td>
            </tr>
            <tr>
              <td><?php echo $entry_fax; ?></td>
              <td><input type="text" name="fax" value="<?php echo $fax; ?>" /></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_city; ?></td>
              <td><input type="text" name="city" value="<?php echo $city; ?>" />
                <?php if ($error_city) { ?>
                <span class="error"><?php echo $error_city; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_postcode; ?></td>
              <td><input type="text" name="postcode" value="<?php echo $postcode; ?>" />
                <?php if ($error_postcode) { ?>
                <span class="error"><?php echo $error_postcode; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_country; ?></td>
              <td><select name="country_id" onchange="$('select[name=\'zone_id\']').load('index.php?route=account/register/zone&country_id=' + this.value + '&zone_id=<?php echo $zone_id; ?>');">
                  <option value=""><?php echo $text_select; ?></option>
                  <?php foreach ($countries as $country) { ?>
                  <?php if ($country['country_id'] == $country_id) { ?>
                  <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
                  <?php } else { ?>
                  <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
                  <?php } ?>
                  <?php } ?>
                </select>
                <?php if ($error_country) { ?>
                <span class="error"><?php echo $error_country; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_zone; ?></td>
              <td><select name="zone_id">
                </select>
                <?php if ($error_zone) { ?>
                <span class="error"><?php echo $error_zone; ?></span>
                <?php } ?></td>
            </tr>
          </table>
        </div>
        <h2><?php echo $text_your_details; ?></h2>
        <div class="content">
          <table class="form">
         
            <tr>
              <td><span class="required">*</span> <?php echo $entry_firstname; ?></td>
              <td><input type="text" name="firstname" value="<?php echo $firstname; ?>" />
                <?php if ($error_firstname) { ?>
                <span class="error"><?php echo $error_firstname; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_lastname; ?></td>
              <td><input type="text" name="lastname" value="<?php echo $lastname; ?>" />
                <?php if ($error_lastname) { ?>
                <span class="error"><?php echo $error_lastname; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_email; ?></td>
              <td><input type="text" name="email" value="<?php echo $email; ?>" />
                <?php if ($error_email) { ?>
                <span class="error"><?php echo $error_email; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_telephone; ?></td>
              <td><input type="text" name="telephone" value="<?php echo $telephone; ?>" />
                <?php if ($error_telephone) { ?>
                <span class="error"><?php echo $error_telephone; ?></span>
                <?php } ?></td>
            </tr>
            
          </table>
        </div>
        <h2><?php echo $text_your_password; ?></h2>
        <div class="content">
          <table class="form">
            <tr>
              <td><span class="required">*</span> <?php echo $entry_password; ?></td>
              <td><input type="password" name="password" value="<?php echo $password; ?>" />
                <?php if ($error_password) { ?>
                <span class="error"><?php echo $error_password; ?></span>
                <?php } ?></td>
            </tr>
            <tr>
              <td><span class="required">*</span> <?php echo $entry_confirm; ?></td>
              <td><input type="password" name="confirm" value="<?php echo $confirm; ?>" />
                <?php if ($error_confirm) { ?>
                <span class="error"><?php echo $error_confirm; ?></span>
                <?php } ?></td>
            </tr>
          </table>
        </div>
        <h2><?php echo $text_newsletter; ?></h2>
        <div class="content">
          <table class="form">
            <tr>
              <td><?php echo $entry_newsletter; ?></td>
              <td><?php if ($newsletter == 1) { ?>
                <input type="radio" name="newsletter" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="newsletter" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="newsletter" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="newsletter" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
            </tr>
          </table>
        </div>
        <?php if ($text_agree) { ?>
        <div class="buttons">
          <div class="right"><?php echo $text_agree; ?>
            <?php if ($agree) { ?>
            <input type="checkbox" name="agree" value="1" checked="checked" />
            <?php } else { ?>
            <input type="checkbox" name="agree" value="1" />
            <?php } ?>
            <a onclick="$('#register').submit();" class="button"><span><?php echo $button_continue; ?></span></a></div>
        </div>
        <?php } else { ?>
        <div class="buttons">
          <div class="right"><a onclick="$('#register').submit();" class="button"><span><?php echo $button_continue; ?></span></a></div>
        </div>
        <?php } ?>
      </form>
      <?php echo $content_bottom; ?></div>
    
    
    <script type="text/javascript"><!--
    $('select[name=\'zone_id\']').load('index.php?route=account/register/zone&country_id=<?php echo $country_id; ?>&zone_id=<?php echo $zone_id; ?>');
    //--></script> 
    
    
    <script type="text/javascript"><!--
    $('.fancybox').fancybox({
    	width: 560,
    	height: 560,
    	autoDimensions: false
    });
    //--></script>  
    <?php echo $footer; ?>

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    It is clear that it is not your code, as long as you don't even know the difference between Java and JavaScript. Different languages with different scopes.

    On the other hand, I see no checkbox there

    Anyway, you have made an HTML error: you have nested a FORM element within another FORM element, which is HTML and JavaScript illegal.
    Code:
    <form action="http://qodeplay.com/opencart_v1.5.1.1/upload/index.php?route=account/register" method="post" enctype="multipart/form-data" id="register">
    // ... some code
    <form name="form1" action="#" method="post">
    /...
    </form>
    // ... some code
    </form>
    You should create your DOM structure in such way, so that the forms should be independent, one from each other. Or use a single form and change dynamically (via JavaScript) the value of the action attribute, according to your needs.

  3. #3
    Join Date
    Sep 2011
    Posts
    4

    Talking :)

    hi kor, true, i spend so much time in the office looking after all the computers im freekin tired and i dont know what im saying, i realise java and javascript are too different languages so i apologize for that.

    only until now i realised i had a form within a form, and now that i fixed that up, it works perfectly fine.

    i just want to say thankyou very much, you dont understand how much you saved my arse, your the best,have a good day. PEACE!

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You are welcome. Most of the time coders don't sense the tight relationship between JavaScript and HTML, so that any error in one language will bring errors as well within the other one

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles