Announcement

Collapse
No announcement yet.

Odd Javascript error.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Odd Javascript error.

    http://www.nintendoeye.com/forums/ne...read&forumid=7

    How might I fix that error, it isn't assosiated with the VB Code so what do you suggest might be the problem? I havn't changed any templates (except the options and colors ones)...

    If you need a test user.
    Username: test
    Password: test

  • #2
    I -think- it's a bug.
    It seems to me you set the max chars per post to 0. So, the Javascript will think the post is too long from the very start!
    Try setting this to 10000 and see if it solves the problem.

    Good luck!

    EDIT:
    I just set the limit to 0 on my forums, and I didn't get the error. Guess I was wrong...
    Last edited by Chen; Thu 23 Aug '01, 6:32am.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      Can you post any JavaScript from your newthread template here?

      What do you have your max characters per post set to in the CP?

      Comment


      • #4
        It was on 0 but I changed it to 10000 but no luck there.

        I did try going over this template with my eyes but I couldn't spot anything wrong so I'm going to paste the whole lot and hope it doesn't take too long for your trained eyes to find the problem. Don't want to waste your day or anything.

        Code:
        {htmldoctype}
        <html>
        <head>
        <title>$bbtitle - Post New Thread</title>
        $headinclude
        <!--<script type="text/javascript" language="javascript" src="$bburl/spellcheck/spch.js"></script>-->
        <script language="javascript">
        <!--
        var postmaxchars = $postmaxchars;
        function validate(theform) {
        	if (theform.message.value=="" || theform.subject.value=="") {
        		alert("Please complete the subject and message fields.");
        		return false; }
        	if (postmaxchars != 0) {
        		if (theform.message.value.length > $postmaxchars) {
        			alert("Your message is too long.
        
        Reduce your message to $postmaxchars characters.
        It is currently "+theform.message.value.length+" characters long.");
        			return false; }
        		else { return true; }
        	} else { return true; }
        }
        function checklength(theform) {
        	if (postmaxchars != 0) { message = "
        The maximum permitted length is $postmaxchars characters."; }
        	else { message = ""; }
        	alert("Your message is "+theform.message.value.length+" characters long."+message);
        }
        //-->
        </script>
        </head>
        <body>
        $header
        
        <!-- breadcrumb -->
        <table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextra} align="center">
        <tr>
        	<td width="100%">$navbar</td>
        </tr>
        </table>
        <!-- /breadcrumb -->
        
        $postpreview
        
        <br>
        
        <form enctype="multipart/form-data" action="newthread.php" method="POST" name="vbform" onSubmit="return validate(this)">
        <input type="hidden" name="s" value="$session[sessionhash]">
        <input type="hidden" name="forumid" value="$forumid">
        <input type="hidden" name="action" value="postthread">
        
        <table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextra} width="{contenttablewidth}" align="center"><tr><td>
        <table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
        <tr>
        	<td bgcolor="{tableheadbgcolor}" colspan="2"><normalfont color="{tableheadtextcolor}" class="thtcolor"><b>Post New Thread</b></normalfont></td>
        </tr>
        $logincode
        <tr bgcolor="{secondaltcolor}">
        	<td bgcolor="{secondaltcolor}"><normalfont><b>Subject:</b></normalfont></td>
        	<td bgcolor="{secondaltcolor}"><normalfont><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1"></normalfont></td>
        </tr>
        $posticons
        $vbcode_buttons
        <tr>
        	<td bgcolor="{secondaltcolor}" valign="top" nowrap><normalfont><b>Message:</b></normalfont>
        		<p><smallfont>
        		See Forum Rules (below) for<br>
        		more information about what<br>
        		codes you are allowed to use<br>
        		in your posts.
        	</smallfont></p>
        	$vbcode_smilies</td>
        	<td bgcolor="{secondaltcolor}">
        		<table cellpadding="0" cellspacing="0" border="0">
        		<tr valign="top">
        			<td><textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea><br>
        			<smallfont><a href="javascript:checklength(document.vbform);">[check message length]</a></smallfont></td>
        		</tr>
        		</table>
        	</td>
        </tr>
        <tr>
        	<td bgcolor="{firstaltcolor}" valign="top"><normalfont><b>Options:</b></normalfont></td>
        	<td bgcolor="{firstaltcolor}" valign="top"><smallfont>
        		<input type="checkbox" name="parseurl" value="yes" $parseurlchecked> <b>Automatically parse URLs:</b> automatically adds  and  around internet addresses.
        		<br><input type="checkbox" name="email" value="yes" $emailchecked> <b>Email Notification:</b> emails sent to you whenever someone replies. Only registered users are eligible.
        		$disablesmiliesoption
        		<br><input type="checkbox" name="signature" value="yes" $signaturechecked> <b>Show Signature:</b> include your profile signature.  Only registered users may have signatures.
        	</smallfont></td>
        </tr>
        $attachmentoption
        $postpolloption
        </table>
        </td></tr></table>
        
        <br>
        
        <table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextra} align="center">
        <tr>
        	<td align="center"><normalfont>
        	<input type="submit" class="bginput" name="submit" value="Submit New Thread" accesskey="s" tabindex="3">
        	<input type="submit" class="bginput" name="preview" value="Preview Post" accesskey="p" tabindex="4">
        	<!--<input type="button" class="bginput" value="Spell Check" onclick="var f=document.forms['vbform']; doSpell( '$spellchecklang', f.message, '$bburl/spellcheck/sproxy.php', true);" tabindex="5">-->
        	</normalfont></td>
        </tr>
        </table>
        
        </form>
        
        <table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextra} align="center">
        <tr>
        	<td><smallfont><b>Forum Rules:</b><br>$forumrules</smallfont></td>
        </tr>
        </table>
        
        $footer
        
        </body>
        </html>

        Comment


        • #5
          Code:
          <script language="javascript">
          <!--
          var postmaxchars = $postmaxchars;
          function validate(theform) {
          	if (theform.message.value=="" || theform.subject.value=="") {
          		alert("Please complete the subject and message fields.");
          		return false; }
          	if (postmaxchars != 0) {
          		if (theform.message.value.length > $postmaxchars) {
          			alert("Your message is too long.\n\nReduce your message to $postmaxchars characters.
          It is currently "+theform.message.value.length+" characters long.");
          			return false; }
          		else { return true; }
          	} else { return true; }
          }
          function checklength(theform) {
          	if (postmaxchars != 0) { message = "
          The maximum permitted length is $postmaxchars characters."; }
          	else { message = ""; }
          	alert("Your message is "+theform.message.value.length+" characters long."+message);
          }
          //-->
          </script>
          Try replacing the section between the <script> tags with what I have posted above.

          Comment

          Loading...
          Working...
          X