jo*********@gmail.com a écrit :
think I must be going nuts). Here is a link to my form:
http://perla.princeton.edu/counselors/organization.php
Now, look at the code. No onsubmits, just a couple of necessary hidden
inputs.
I've looked through the "code", i think you should start cleaning all
the HTML mess (missing tags, tags not allowed into another, missing
attributs, bad content-type, etc.) before thinking about getting
something reliable from javascript ! I'm gonna cut/paste some of the
markup, but around 10/15 HTML problems or warning in a 15 lines
document, i think it's too much.
Your page is served as text/html, so there is no need for the /> that's
can be seen everywhere on your page. Anyway, let's assume it's a quick
and dirty cut/paste from a real XHTML page but if so, the test page is
not acurate to the issue you encounter in real world. Sometimes the
javascript behavior is slightly different in HTML and XHTML. Is your
page HTML or XHTML ?
No doctype, that's a bad practice, please choose one.
<html>
<form method="post" name="MemberDirectory" id="MemberDirectory"
action="http://...Directory/?NRMODE=Published&...">
Here the method is post but the action is looking like a get request. I
dont think it's clever to mix post and get requests. I bet the problem
you encounter is comming from this.
[snip]
</form>
<input type="submit" onclick="javascript
:notfirstpage();" />
Again, no need for the /> if it's not a XHTML document.
Input tag outside a form ? The structure of a HTML document does not
allow to insert all type of tags in all conditions.
onclick="javascript
: ... " is totally wrong, please just use
onclick="return my_function();"
And why use a submit type ? Don't you just want a button ?
<script language="JavaScript">
If you are reading this newsgroup you should know by now this is the
crappiest way to insert a script. It's useless to use the language
attribute and the type attribute is required.
You should instead use <script type="text/javascript">
function notfirstpage()
{
form1 = document.forms["MemberDirectory"];
form1.submit();
}
Perhaps it would be wise to read the newsgroup before asking, or at
least read documentations.
when you do
form1 = document.forms["MemberDirectory"];
the variable "form1" is created in the global scope, you want here to
use a local variable, so you must use : var
var form1 = document.forms["MemberDirectory"];
Since notfirstpage() is the onclick handler, you must return true or
false to abort or keep running the event.
Anyway, imo the problem is inside the confusion between post method and
get url of the form's action.
--
laurent