dcsimg
Submitting a FORM using JavaScript
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alan_Megargel
Posted On:   Thursday, January 2, 2003 01:39 AM

The following code works fine. It submits the FORM as expected. However, this only works if there is no submit button present in the FORM. If there is a submit button present, then the below code has no effect. How do I fix this?


			
function mySubmit(){
document.myForm.submit();
}

Re: Submitting a FORM using JavaScript

Posted By:   atanu_dey  
Posted On:   Thursday, January 2, 2003 03:17 AM

Hi Alan,



How are u calling this method in your javascript? If u want to call this method on clicking a submit button, then u have to call the function like this :





else, if u r calling this from a button, then like this :



Re: Submitting a FORM using JavaScript

Posted By:   Nitesh_Naveen  
Posted On:   Thursday, January 2, 2003 03:02 AM

it is not because the submit button is present that the function doesn't work... its probably because you've named the submit button as submit. Once you have a form element with the name 'submit' you'll land up in problems bcoz the element takes precedence over the submit function. Rename the submit button to say 'm_submit' and see...
About | Sitemap | Contact