Web Design and Development Forums

Table Hide function error

This is a discussion on "Table Hide function error" within the JavaScript Forum section. This forum, and the thread "Table Hide function error are both part of the Program Your Website category.

Old Apr 25th, 2008, 16:51   #1 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: England
Age: 20
Posts: 21
Table Hide function error

Hi, I've made a form for my users to edit their personal details once they are registered. This includes a section called NUS and NUS Number (National Union of Students in UK) and every time the user clicks on the NUS check button it hides/unhides the NUS Num section below it.

Now what's wrong with it is that if the user has selected NUS it activates the checkbutton and fills out the NUS Number field, but for some reason it stops the check button from being clicked on and using the function again. This produces no errors in my Error Console in Fire Fox and the strange thing is that if the user doesn't have NUS selected prior to this then the check button and function works fine.

Here's the function code:

Code: Select all
function NUSHide(f){
   var mode;
   <?php
   if($Cont == false)
   {
      if($NUS == 1)
      {
         ?>
         document.Edit_Details_Form.NUS.checked = true
         mode="block";
         <?php
      }
      else
      {
         ?>
         if(document.Edit_Details_Form.NUS.checked == true)
         {
            mode="block";
         }
         else if(document.Edit_Details_Form.NUS.checked == false)
         {
            mode="none";
        document.Edit_Details_Form.NUSNum.value="";
         }
     <?php  
      }
      ?>
      return document.getElementById('NUSHide').style.display=mode;
      <?php
   }
   else
   {
      ?>
      return false;
      <?php 
   }
   ?>
}
and here is the form code with the NUS part at the bottom:

Code: Select all
<body onLoad="javascript:NUSHide(document.getElementById('NUSHide'));">
<div class="MainContainer">

<?php require('admin/header.inc');
require('menu.inc') ?>
 
<div class="DivMain">
<?php
if($Cont==true)
{
   ?>
   <span class="head2"><?php echo $MsgEdited?></span><br><br>
   <a href="my_account.php">Back to My Account</a>
   <?php

   $conn = mysql_connect($Host,$Username,$Password) or die(mysql_error());
   $db = mysql_select_db($Dbname, $conn); 
   $sql2 = "SELECT Email FROM UserAccount WHERE UserID='$EditThisUser'";
   $rs2 = mysql_query($sql2, $conn)or die('Problem with query: ' . $sql2 . '<br />' . mysql_error());
   $row2 = mysql_fetch_array($rs2);

   $Email = $row2['Email'];

   mysql_close($conn);

      $message="";
      $message=$message."<html>";
      $message=$message."<body>";
      $message=$message."<span style=\"font-family:Comic Sans MS; font-size:24pt; text-align:center; background-color:#E61732; color:white; font-weight:bold\">A&WC Clothing Line</span><br>";
      $message=$message."This is a confirmation that you changed your account details.<br><br>";
      $message=$message."Your new Password is: $NewPass"."<br>";
      $message=$message."If you were not the one responsible for changing this password then please contact The Hub immediately and we will try to sort the problem out for you.";
      $message=$message."</body>";
      $message=$message."</html>";
      
      if (mail($UserEmail,"$User - Change Account Details Confirmation - A&WC Clothing Line",$message,"Content-Type:text/html;charset=us-ascii")) {
         $MsgChange= "Your password has been changed successfully!";
      } else {
         $MsgChange= "Can't send e-mail on this system... Doh!";
     die();
      }
}
else
{
   ?>
   <span class="head2">Edit Account Details Form</span><br>
   <span class="errmsg">All fields marked with an * are required</span><br>

   <?php 
   echo $MsgUser;
   echo $MsgForename;
   echo $MsgSurname;
   echo $MsgCampus;
   echo $MsgCourse;
   echo $MsgNUSNum;
   ?>

   <span id="mySpan1a" class="mySpan1a"><br></span>
   <span id="mySpan2a" class="mySpan2a"><br></span>
   <span id="mySpan3a" class="mySpan3a"><br></span>
   <span id="mySpan4a" class="mySpan4a"><br></span>
   <span id="mySpan5a" class="mySpan5a"><br></span>
   <span id="mySpan6a" class="mySpan6a"><br></span>
   <br>

   <form method="post" name="Edit_Details_Form" action="edit_details_form.php" onSubmit="return Validate(this);">

    <table style="width:auto; position:absolute;">
    
    <table>
    <tr><td><?php echo $Err1?><span id="mySpan1b" class="mySpan1b"></span><span class="head4">Username:(Max Length 15 chars)</span><span class="errmsg"> *</span></td>
    <td><label><input type="text" maxlength="15" name="Username" value="<?php echo $User?>"/></label></td></tr> 

    <tr><td><?php echo $Err2?><span id="mySpan2b" class="mySpan2b"></span><span class="head4">Forename:</span><span class="errmsg"> *</span></td>
    <td><label><input type="text" maxlength="15" name="Forename" value="<?php echo $Forename?>"/></label></td></tr>
     
    <tr><td><?php echo $Err3?><span id="mySpan3b" class="mySpan3b"></span><span class="head4">Surname:</span><span class="errmsg"> *</span></td>
    <td><label><input type="text" maxlength="20" name="Surname" value="<?php echo $Surname?>"/></label></td></tr>   

    <tr><td><?php echo $Err4?><span id="mySpan4b" class="mySpan4b"></span><span class="head4">Campus based at: </span><span class="errmsg"> *</span></td>
    <td><label><select name="Campus"/><option value="">Please Select a Campus</option>    

    <?php
    $conn = mysql_connect($Host,$Username,$Password) or die(mysql_error());
    $db = mysql_select_db($Dbname, $conn);
    $sql = "SELECT Campus FROM Campus ORDER BY Campus";
    $rs = mysql_query($sql, $conn) or die(mysql_error());
     
    while($row = mysql_fetch_array($rs))
    {
       $Camp = $row['Campus'];
       echo"<option value='$Camp'";
       if($Campus == $Camp)
       {echo"Selected";}
       echo">$Camp</option>";
    }
    mysql_close($conn);
    ?>
    </select></label></td></tr>
    <tr></tr>

    <tr><td><?php echo $Err5?><span id="mySpan5b" class="mySpan5b"></span><span class="head4">Course Name:</span><span class="errmsg"> *</span></td>
    <td><label><input type="text" size="45" name="Course" value="<?php echo $Course?>"/></label></td></tr>
    <tr></tr>

    <tr><td><span class="head4">NUS:</span></td>
    <td><label><input type="checkbox" name="NUS" <?php if($NUSChk == "on"){echo"Checked";}?> id="NUS" onclick="NUSHide(this)"/></label>
    </td></tr>  
    </table>
    <table width="564" class="TableHidden" id="NUSHide">
    <tr width="340px"><td width="266"><?php echo $Err6?><span id="mySpan6b" class="mySpan6b"></span><span class="head4">NUS Number: (18 Chars)</span></td>
    <td width="240"><label><input type="text" maxlength="21" name="NUSNum" value="<?php echo $NUSNum?>"/></label></td></tr>
    </table>
    <table>
    <tr><td><label><input type="submit" style="overflow:visible; width:auto" class="buttonS" 
    name="SubmitB" value="Submit" onMouseOver="OverMouse(this)"; onMouseOut="OutMouse(this)"/>
    </label>
    </td></tr>  
    </table>
    </form>
    <br><br>
    <a href="my_account.php">Back to My Account</a>
    <?php
}
?>
</div>
</div>
</body>
P.S. $Cont is only used after the form has been submitted successfully so I added that to stop the undefined function error.
psycho wolvesbane is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 25th, 2008, 22:49   #2 (permalink)
Junior Member
 
Join Date: Feb 2008
Location: England
Age: 20
Posts: 21
Re: Table Hide function error

Edit: Solved by self
psycho wolvesbane is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keep getting error message Microsoft VBScript runtime error '800a01a8' cpando1974 ASP Forum 2 Aug 7th, 2007 12:00
multiple table data retrieval with function Wheatus7 MySQL 0 Jun 26th, 2007 13:01
Fatal error: call to a member function funtion() on a non-object timcallagy MySQL 2 Mar 4th, 2007 21:55
Fatal error: Call to a member function getName() on a non-object jono PHP Forum 1 Apr 13th, 2006 18:53
Having trouble with scripts. Fatal error: Call to undefined function: imagegif() cargi PHP Forum 5 Jan 6th, 2006 18:59



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 19:10.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59