|
-
December 18th, 2006, 04:41 PM
#1
form submission with Javascript
Hello!
I am searching over the net for quite a long, but I have almost no idea concerning Javascript so I can't figure out the solution to my problem...
I have a form that show a drop-down menu, which takes all its values through a Mysql database via PHP. What I want to do is to submit the form to the next page (from index.php ---> retrieve_data.php) without the need of a "Submit" button.
When the user selects one of the given options, automatically he will be redirected to retrieve_data.php?id=5 for example...
Thank you in advance!
-
December 18th, 2006, 04:48 PM
#2
Re: form submission with Javascript
Call the document then the form then submit.
Code:
document.FORMNAME.submit()
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
January 30th, 2007, 09:11 AM
#3
Re: form submission with Javascript
For some reason this just doesn't work for me. If I click my button which launches this nothing happens.
Code:
function submitForm()
{
document.markForm.submit();
}
Code:
<form method="post" name="markForm" id="markForm" action="update_entry.php">
Code:
<input type="button" name="submit" value="Update Marks" class="SubmitButton" onClick="submitForm()" />
I can't see anything wrong with that. My button takes the place of my submit as you can see.
Edited:
Eventually found out that I was getting this error in Firefox error console and looked it up:
"Error: document.markForm.submit is not a function"
What I found out is the the submit button with the name of "submit" can clash with the submit function. I changed the submit button's name and it worked fine.
Last edited by Nibinaear; January 31st, 2007 at 04:38 AM.
-
February 1st, 2007, 10:41 AM
#4
Re: form submission with Javascript
You have the concept, it is done like you wrote. But little observation:
put
Code:
onClick="submitForm();"
instead of
Code:
onClick="submitForm()"
but i've no idea if it would fix the problem, since the error happen while submitting!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|