You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marshall Levin <ma...@harvard.edu> on 2007/05/11 22:44:04 UTC

Trouble with

Hi,

I have a page that has a tag like this:

    <html:submit property="submit" value="Preview Post"/>

Now I am adding a feature that will automatically submit the form under 
certain circumstances, so I have some Javascript like this:

    document.postForm.submit();

I can see from 
http://www.chovy.com/personal/javascript-error-submit-is-not-a-function/ 
and http://www.mail-archive.com/user@struts.apache.org/msg19691.html 
that this won't work if there is any form element named "submit" -- so I 
finally got the Javascript submit to work by renaming my Struts submit 
button.

But unfortunately, if I name it anything other than "submit," things 
break once the form is actually submitted to the action. Specifically, 
if I don't use property="submit" but rather property="foo," I will get 
an IndexOutOfBoundsException coming from somewhere in PropertyUtils. As 
soon as I set it back to property="submit," it works again (but of 
course my Javascript submit stops working).

Any way around this? Does Struts require that the property be "submit" 
here? I can't find anything in *my* code that's specifically looking for 
a request parameter named "submit."

Thanks

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


Re: Trouble with

Posted by Martin Gainty <mg...@hotmail.com>.
Good Evening Marshall

Is there a reason why you want to override the template name ?

@StrutsTag(name="submit", 
tldTagClass="org.apache.struts2.views.jsp.ui.SubmitTag", description="Render 
a submit button")
public class Submit extends FormButton implements RemoteUICallBean{

    private static final Log LOG = LogFactory.getLog(Submit.class);

    final public static String TEMPLATE = "submit";

Ever go to the square?
Thx/
M--

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Marshall Levin" <ma...@harvard.edu>
To: <us...@struts.apache.org>
Sent: Friday, May 11, 2007 4:44 PM
Subject: Trouble with <html:submit>


> Hi,
>
> I have a page that has a tag like this:
>
>    <html:submit property="submit" value="Preview Post"/>
>
> Now I am adding a feature that will automatically submit the form under 
> certain circumstances, so I have some Javascript like this:
>
>    document.postForm.submit();
>
> I can see from 
> http://www.chovy.com/personal/javascript-error-submit-is-not-a-function/ 
> and http://www.mail-archive.com/user@struts.apache.org/msg19691.html that 
> this won't work if there is any form element named "submit" -- so I 
> finally got the Javascript submit to work by renaming my Struts submit 
> button.
>
> But unfortunately, if I name it anything other than "submit," things break 
> once the form is actually submitted to the action. Specifically, if I 
> don't use property="submit" but rather property="foo," I will get an 
> IndexOutOfBoundsException coming from somewhere in PropertyUtils. As soon 
> as I set it back to property="submit," it works again (but of course my 
> Javascript submit stops working).
>
> Any way around this? Does Struts require that the property be "submit" 
> here? I can't find anything in *my* code that's specifically looking for a 
> request parameter named "submit."
>
> Thanks
>
> ---------------------------------------------------------------------
> 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