javascript submit() function performs differently from clicking submit

L

ljlolel

I'm posting this again because I did not explain myself well the first
time, so the problem was not being addressed. I made the following
page ( http://perla.princeton.edu/counselors/organization.php ) solely
for the purpose of showing a bug. It is not production code, it is a
test, made for testing, so style really doesn't matter.

This page illustrates that, for some reason, clicking on the submit
button has a different effect on the results page than running the
javascript submit() function. Try it out for yourself. Click the
submit button on top. It returns results 1-15 of the organizations at
nacacnet.org. Now, click the second button, which runs the javascript
submit() function, it returns results 76-90. This is what _should_ be
returned. Unfortunately, I cannot understand why clicking the submit
button should be any different, since the same fields are posted to the
server (use Firefox's page info while the results are loading to see
that this is true). Are the headers different for some reason?

I do not need a solution or an alternative, as this is not a real page
for production use, nor is it an example page for production use. I
have an intellectual curiosity to understand how javascript works at
the most basic level to understand why different results would come
between these two methods of submitting.
 
T

Tim

Click the
submit button on top. It returns results 1-15 of the organizations at
nacacnet.org. Now, click the second button, which runs the javascript
submit() function, it returns results 76-90. This is what _should_ be
returned.

Here's the html for the submit button which incorrectly returns results
1-15

<input type="submit" name="ucSearch:btnSearch" id="ucSearch:btnSearch"
value="Click Submit Button" />

If you remove the id and name attribute's then both buttons return
results 76-92.

Richard Cornford explained why this happens when he replied to your
earlier post.

Tim
 
J

josephperla

Thank you. Also, thank you very much Richard Conford. I must have
missed his explanation earlier when I was reading the previous replies.
So, I guess when javascript runs the submit() function, it doesn't
send the name/value pair, but when you click the button, it does send
the name/value pair. Thanks again.
j
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top