please some one give me a simple code for this
Dynamic form submission through Java Script
Collapse
X
-
Tags: None
-
Hi,Originally posted by chanchal21pesplease some one give me a simple code for this
You can define a function like this;
[CODE=javascript]
function submit()
{
document.form.s ubmit();
}
[/CODE]
inside the script tag or in your javascript file and call it anywhere you like, to submit the page.
Happy Programming !
:) -
Yes,Originally posted by jhardmanYou can also put this just inside nearly any HTML tag:
[CODE=html]
onClick="docume nt.form.submit( )"
[/CODE]
you are right. But I think, if we have to submit after validating some form fields then it would be better to have a user defined function for validating and then submitting.
And I am not sure but this one;
may work.Code:onClick="this.submit()"
Thanks.
Merry Christ mass!
:)Comment
-
If the element is in a form, it would work like this:Originally posted by Ranjan kumar BarikAnd I am not sure but this one;
may work.Code:onClick="this.submit()"
you need to reference the form since it is the form that is submitted. Good point about the function, by the way.Code:onClick="this.form.submit()"
JaredComment
-
Thanks a lot.Originally posted by jhardmanIf the element is in a form, it would work like this:
you need to reference the form since it is the form that is submitted. Good point about the function, by the way.Code:onClick="this.form.submit()"
Jared
Have a good day!
:)Comment
Comment