Jump to content

Script stopped working


The Praetorian

Recommended Posts

Hi. I'm using this script ... Here ... to validate my mail form to make sure people aren't sending in blank forms. It worked fine until I added this code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>The Shattered Realms ~ Application</title><?php include 'meta.txt'?><link rel="stylesheet" type="text/css" href="new.css" media="all" /><script type="text/javascript" language="javascript" src="app.js"></script><script type="text/javascript" language="javascript">function hideshow(which){    if (!document.getElementById)        return;    var spans = document.getElementsByTagName("span");    for(var i = 0; i < spans.length; i++)    {        if(spans[i].className == "hide")            spans[i].style.display = "none";    }    if (which.style.display != "inline")        which.style.display = "inline";}</script><style type="text/css">.hide {display:none;}</style></head><body><table border="0" cellspacing="2" cellpadding="0" class="table" align="center">	<tr>		<td colspan="2">			<?php include 'menutop.txt'?>		</td>	</tr>	<tr>	<td class="lnavigate" valign="top">			<?php include 'menu.txt'?>	</td>	<td class="content" valign="top">			<div class="header">~   The Application   ~</div>			<div class="maincontent"><form method="post" action="appmail.php" name="app" onsubmit="return ValidateRequiredFields();"><h1>Character Information</h1><br /><p>* : Required Fields</p><p><b>* Name</b><br /><input type="text" name="CharacterName" size="20" /><br /></p><p><b>* Nationality</b> ( + Requires you to choose a Race/Sub-species )<br /><input type="radio" name="Nation" value="Ihthian" onclick="hideshow(document.getElementById('raceone'))" /> : Ihthian +<span id="raceone" class="hide"> |  Pahth : <input type="radio" name="Race" value="Pahth" />  Roehn : <input type="radio" name="Race" value="Roehn" />  Theyhn : <input type="radio" name="Race" value="Theyhn" />  Ohnen : <input type="radio" name="Race" value="Ohnen" /></span><br /><input type="radio" name="Nation" value="Siyk" /> : Siyk<br /><input type="radio" name="Nation" value="Shani" /> : Shani<br /><input type="radio" name="Nation" value="Ush'ii" /> : Ush'ii<br /><input type="radio" name="Nation" value="Ikarri" onclick="hideshow(document.getElementById('racetwo'))" /> : Ikarri +<span id="racetwo" class="hide"> |  Kiil : <input type="radio" name="Race" value="Kiil" />  Iken : <input type="radio" name="Race" value="Iken" /></span><br /></p><p><b>* Age</b> : <input type="text" name="CharacterAge" size="2" /></p><p><b>* M:</b><input type="radio" name="Gender" value="Male" />  <b>F:</b><input type="radio" name="Gender" value="Female" /></p><p><b>Shapers</b> <input type="checkbox" name="Guild" value="Yes" /><br />Check this box if you would like your character to be a Shaper.<br />(<b>Required reading: </b><a href="laws.php" target="_blank">The Laws of the Deep</a>, <a href="pathfinders.php" target="_blank">The Pathfinders</a>.)</p><p><b>* Brief History</b><br /><textarea name="History" rows="15" cols="52"></textarea></p><p><b>* Writing Sample</b><br /><textarea name="WritingSample" rows="15" cols="52"></textarea></p><br /><h1>Personal Information</h1><p>Please be honest. None of this information will be given out to anyone.</p><p><b>* Email</b><br /><input name="Email" type="text" size="20" /></p><p>Needless to say, please make sure your email is correct, otherwise you could be waiting a long time to hear back from us.</p><p><b>Name/Alias</b><br /><input name="Alias" type="text" size="20" /></p><p>This isn't a required field. If you want to put your first name here you can, or you can put a nickname you'd like people to use. It's entirely up to you.</p><p><b>* Age</b> : <input name="YourAge" type="text" size="2" /></p><p><b>M:</b><input type="radio" name="YourGender" value="Male" />  <b>F:</b><input type="radio" name="YourGender" value="Female" /></p><p><b>ICQ</b><br /><input type="text" name="Icq" size="20" /></p><p><b>AIM</b><br /><input type="text" name="Aim" size="20" /></p><p><b>MSN</b><br /><input type="text" name="Msn" size="20" /></p><h1><input type="submit" value="Apply" class="button" /></h1></form>			</div>		</td>	</tr>	<tr>		<td colspan="2" align="right" class="copyright"><p>The Shattered Realms © 2006 David Ash. All Rights Reserved.</p></td>	</tr></table></body></html>

Link to comment
Share on other sites

<!-- Copyright 2005 Bontrager Connection, LLC//// Two places need to be customized.////// Place 1:// Between the quotation marks, specify the name of// your form.The script here

This is from the JS file and that can't be right can it? =/I don't think you're gonna use <!-- in a .js file...but if you use <script type="text/javascript"><!-- Script --></script> it might be right.Just so you know, I'm not excactly a racer in JavaScript :)

Link to comment
Share on other sites

Well, I removed the <!-- --> from the js file and it still won't work.Honestly I think it's the other javascript that I have, because I'm using this validation script on another mail form and it works fine. Same script. For some reason I think adding the collapse/expand script messed up the other one.. but I'm not sure how...

Link to comment
Share on other sites

After some random testing.. I discovered that this script has only stopped working on Firefox. It still works on IE and on Opera. Very confusing.
Does Firefox report any errors? If so, what are those errors? If not, you might try adding an alert in the validation code just to make sure that the code is executing:
function ValidateRequiredFields(){alert("Well?  Does this show up?");var FieldList = RequiredFields.split(",")...

I noticed that on your Contact Us form, you're using a file called mail.js whereas on the Apply form, you're using app.js. Perhaps there's a minor difference between the two codes that you may be overlooking?

Link to comment
Share on other sites

Firefox doesn't report any errors. It runs the page fine and seems to ignore the script altogether.I looked at both forms, and they both seem to be the same. Only slightly different because one form is longer than the other.As for that validation script, could you be more specific? heh. I don't really know a whole lot about writing javascript.

Link to comment
Share on other sites

As for that validation script, could you be more specific? heh. I don't really know a whole lot about writing javascript.
Oh, I was just suggesting that you put in an alert into your ValidateRequiredFields function. That way, if the page calls that function, the alert will pop up and you'll know that you're on the right track. If the alert doesn't come up, then that function isn't being called. It's just a way to start debugging your scripts.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...