|
Hello folks, I'm new to this forum and I'm thankful to have found it!
I'm having an issue with a form. http://smithforjudge.com/3.htm
Basically I need to have one of the check boxes act as a validator for the form, where if checked, the form submits to the email and if the box isn't checked then another .htm doc comes up, giving the user further instructions.
Someone already wrote a bit of code for me. Just a simple if statement:
if (!theForm.C2.checked) {
// submit to new html page
// otherwise sumbit to set action page.
theForm.action = "/forum/errorpage.htm";
}
return (true);
This works because it doesn't submit an email unless the box is checked, except that when I specify the URL on the line that says:
theForm.action = "/forum/errorpage.htm", anything other that errorpage.htm gets an error that says:
Method Not Allowed
The requested method POST is not allowed for the URL /***.htm.
And the address bar on the browser does display the correct URL that I specified, but instead of that .htm, I get the error 405 page. The errorpage.htm gives a standard 404 error.
Any suggestions for making the code allow the URL that I specify to display correctly?
Thank you so much!
|
|
|
Have you tried changing the the form method to GET.
I would guess something like this might do it.
if (!theForm.C2.checked) {
// submit to new html page
// otherwise sumbit to set action page.
theForm.action = "/forum/errorpage.htm";
theForm.method = "GET";
}
try it and let us know.
semper fi...
|
|
|
That was it!!!
Thank you SOOOO much for your prompt response, that works great!
There is one thing though... I'm using FrontPage, and it tends to mess with the code. The page example I posted has <!--webbot bot="HTMLMarkup" startspan --> &
<!--webbot bot="HTMLMarkup" endspan --> around the HTML, which prevents FP from altering the code, but it also causes problems with the design view. So if I may bug you with another question...
where in the code should that IF statement be?
FrontPage erases IF statements from the code when you publish, even if you cut and paste your code, unless you use the tags above. But then the design GUI doesn't work.
As you can gather... I don't know JavaScript at all.
Again, thank you so much for being here and for helping me with this.
|
|
|
Glad to hear it worked. More of an educated guess than really me being an uber-expert in javascript.
But on to your next problem. Again I'm no FrontPage expert but what you could try is taking all the javascript and putting it in a seperate file. So take everything that is between the <script> tags and put it in a seperate file called validation.js
In your html file you would have something like the following
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script type="text/javascript" src="/js/validation.js"></script>
<title>Volunteers sign up</title>
</head>
The above assumes also that the javascript file is saved in a directory called js.
semper fi...
|
|
|
|
|
|
|
|