|
-
Nov 14th, 2000, 11:27 AM
#1
Thread Starter
Hyperactive Member
Is there anyway of Submitting a form in JavaScript without having to press the button. The reason that I want to do this is if enter is pressed in a field, then the form should automatically Submit itself. I've done all the testing for the Enter key and that is working fine, but the problem is the actual submit.
-
Nov 14th, 2000, 01:33 PM
#2
Give your form a name and use something like:
frmTest.submit()
For example, you can do this with a link like so:
<A HREF="doesntmatter.html" onClick="frmTest.submit(); return false;">Clicking here causes form submission, not link following</A>
Paul
-
Nov 15th, 2000, 05:49 AM
#3
Thread Starter
Hyperactive Member
thanks alot PWNettle, thats exactly what I needed.
-
Nov 15th, 2000, 07:00 AM
#4
Thread Starter
Hyperactive Member
except for some reason it doesn't work. Instead I get the error of Object doesn't support this property or method.
I have the following cut down code:
In the JavaScript section:
function textchange(keyasc)
{
if(keyasc==13)
{
myform.Submit();
}
}
</script>
In the HTML:
<form name="myform">
<input type="text" name="textfield" onkeypress="textchange(event.KeyCode);">
<input type="submit name="Submit" value="Search" onClick="return parent.mainFrame.findInPage(this.form.textfield.value);">
</form>
I know when I click the Submit, that works and I also know that the keyasc value is returning the correct values, but I can't get the form to Submit...Please Help!
-
Nov 15th, 2000, 09:54 AM
#5
The only thing I can think of is that the 'submit()' needs to be lowercase. JavaScript is case sensitive. Try '.submit()' rather than 'Submit()' and see if that works.
Paul
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
|