You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sachin <sa...@paradyne.co.in> on 2005/01/19 07:33:59 UTC

help : submit with javascript problem

hi all ,

i have a Struts form defined like ..

<html:form styleId="paraFrm" action="branchMasterViewAction">

and i am tring to submit this form with javascript function like ..
<script>
	function submit() {
		frm=document.getElementById("paraFrm");
		frm.submit();
	}
</script>

but it gives error that object does not support this property or method ..
i tried it with document.forms[0].submit() , but not helped ..

Plz tell me any solution to this ..

Thanks in advance

Regards,
Sachin Hegde
Paradyne Infotech Limited , Mumbai
09324546711


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: help : submit with javascript problem

Posted by Andrew Hill <an...@gridnode.com>.
Make sure you dont have any field or button whose id or name is also 
"submit" as in javascript a function is just another type of object, so 
a button or field on the form named 'submit' will hide the forms submit 
method and your call to frm.submit() would be trying to refer to the 
button which of course isnt a method hence the erro stating that the 
method isnt supported!

btw: Cant remember whether your own js functions will become properties 
of the form or the document object. Probably depends on where you 
declare it? Anyhow you may also want to rename your submit function to 
something like doSubmit to make sure its not shadowing the real 
one.(Though if that was the case Id have expected an infinite loop so 
its probably not your submit method causing the problem but a button or 
field as mentioned above.)


sachin wrote:

> hi all ,
> 
> i have a Struts form defined like ..
> 
> <html:form styleId="paraFrm" action="branchMasterViewAction">
> 
> and i am tring to submit this form with javascript function like ..
> <script>
> 	function submit() {
> 		frm=document.getElementById("paraFrm");
> 		frm.submit();
> 	}
> </script>
> 
> but it gives error that object does not support this property or method ..
> i tried it with document.forms[0].submit() , but not helped ..
> 
> Plz tell me any solution to this ..
> 
> Thanks in advance
> 
> Regards,
> Sachin Hegde
> Paradyne Infotech Limited , Mumbai
> 09324546711
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org