struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Bathje" <...@ntsource.com>
Subject Re: Re: Why does <html:submit> work differently than <html:link action="">?
Date Wed, 28 Jul 2004 16:39:12 GMT
Andy -

Based on your email it is hard to tell, but I think you are attempting to do
a form.submit(); call in the link action to submit the form.

Assuming this is the case, I have the following advice - if you MUST submit
using javascript instead of a submit button, avoid the use of form.submit();
it seems to flake out a lot.

Instead, setup a submit button using CSS to make it not display like so:
<input type="submit" name="fakeSubmitButton" style="display:none;" />

(if you don't know CSS, the style is what makes the button not show up on
the page.)

Then, wherever you have your form.submit(); call now, change it to be
form.fakeSubmitButton.click();

This works far more reliably for me.

Matt Bathje
(sorry for the non-struts stuff!)


----- Original Message ----- 
From: "Jim Barrows" <jbarrows@sssc.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Wednesday, July 28, 2004 11:16 AM
Subject: RE: Re: Why does <html:submit> work differently than <html:link
action="">?


>
>
> > -----Original Message-----
> > From: Andrew Close [mailto:aclose@gmail.com]
> > Sent: Wednesday, July 28, 2004 9:10 AM
> > To: Struts Users Mailing List
> > Subject: Re: Re: Why does <html:submit> work differently than
> > <html:link
> > action="">?
> >
> >
> > hi Robert,
> >
> > yes i've tried using javascript, but i must be doing something wrong.
> > i've tried two approaches.  1) i was calling a javascript function
> > that set the action for me and then submited the form.  but the values
> > inside my hidden fields weren't getting picked up.  2) Wendy gave me a
> > slightly different approach to try by calling the function and setting
> > the values of the hidden fields and then submitting.  however, two of
> > the hidden fields are set upon arrival to the page by my action form.
> > but they are not being picked up when i leave.
> > all of this works flawlessly when using a submit button. :)
>
> That's not surprising, since that's what the submit button is supposed to
do.  You are trying to thing the non-standard and completely screwy way
(which imntbho in general of doing ANYTHING in javascript).  I would suggest
that you are not calling, or setting up the form correctly in your
javascript.  Works with submit, doesn't work with javascript... it's a
javascript issue, not a struts issue.
> I would suggest a javascript form might have more expertise then you might
find here, but posting the javascript would be of help for those who do know
something about javascript.
>
> >
> > andy
> >
> > On Wed, 28 Jul 2004 10:58:44 -0500, Robert Miller
> > <rmiller@ofumic.com> wrote:
> > > Andy,
> > > Sorry, I haven't been following your situation closely.
> > > Have you looked into using Javascript to have the link trigger form
> > > submission?
> > >
> > > An example of what I am talking about can be found here:
> > >
> > http://www.javascript-coder.com/javascript-form/javascript-for
> > m-submit.phtml
> > >
> > > Robert
> > >
> > > >>> aclose@gmail.com 7/28/2004 10:20:01 AM >>>
> > >
> > >
> > >
> > > hi all,
> > >
> > > i'm still struggling with form submission.  i would prefer to use
> > > links on the page to submit my form instead of a 'submit
> > button'.  but
> > > i'm unable to get the correct functionality to work.  when
> > submitting
> > > with the submit button all my hidden fields are slurped up and
> > > populated on the next page correctly.  however, when using
> > <html:link>
> > > i'm only able to get one of the values from my hidden fields slurped
> > > up.  the others remain blank...
> > > using the debugger in my action form i only see one of the three set
> > > methods getting called even though all three hidden fields
> > are inside
> > > the form and are populated.  i am using the <html:hidden> field. ;)
> > > any thoughts?  i'm sure there are others that use links on forms
> > > instead of buttons.  what are you doing?
> > >
> > > thanks
> > > andy
> > >
> > >
> > ---------------------------------------------------------------------
> > > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message