struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <>
Subject RE: LookupDispatchAction onchange
Date Tue, 10 Dec 2002 14:54:13 GMT
Should be possible.
You may need to do something like appending a parameter to your forms action
url with a bit of javascript to simulate whats submitted by a button. Can't
remember the details for LookupDispatchAction since I havent used it, but
heres some js that will play with your forms action and append a parameter
named 'method' with value defined by useMethod.
Adapt as required. (nb: its modified from a similar script (which works with
DispatchAction rather than LookupDispatchAction) of mine for the purposes of
this reply and thus untested!)

function submitBlah(useMethod)
    document.forms[0].action =

function appendParameter(url, parameter, value)
  var delimeter = url.indexOf('?') == -1 ? '?' : '&';
  return url + delimeter + parameter + '=' + value;

Having said all that I should point out that you might be able achieve a
similar effect using an appropriate hidden field too. Much simpler (though
doesnt work too well with multipart forms submitting to a DispatchAction).
If you try that be careful you dont submit 2 values for your property when a
button is clicked.

btw: Just looking at the javadocs for LDA. I see they use 'action' as the
name of their example parameter. Bad idea naming anything on a form
'action'. It will shadow the form.action property (which means above script
wont work for one thing). Same reason that naming a button 'submit' will
lead you into trouble when you later try to add a call to javascripts
form.submit() method...

-----Original Message-----
From: Cook, Graham []
Sent: Tuesday, December 10, 2002 22:27
To: ''
Subject: LookupDispatchAction onchange

Is it possible to use an onchange event on a text input field to submit the
form to a LookupDispatchAction?

I have numerous buttons on the JSP page which submit the form to my
LookupDispatchAction, and work depending on what the value of the action is,
but i would like to also call my LookupDispatchAction from an onchange event
of a text field?

Anyone done this?

" This message contains information that may be privileged or confidential
is the property of the Cap Gemini Ernst & Young Group. It is intended only
the person to whom it is addressed. If you are not the intended recipient,
are not authorized to read, print, retain, copy, disseminate, distribute, or
this message or any part thereof. If you receive this message in error,
notify the sender immediately and delete all copies of this message ".

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message