I have only one form in my JSP.
My question was not clear that is why I explain agin my problem.

My problem is the following I have a form:

<html:form action="/setupLookupDispatchAction.do" method="GET">
 
- with hyperlinks:
 <html:link page="/setupLookupDispatchAction.do" paramId="method"
paramName="call" onclick="document.forms[0].submit();">

- with buttons
<html:submit property="method" styleClass="myButton" ><bean:message
key="button.cancel"/></html:submit>

In the setupLookupDispatchAction I test the method parameter
public ActionForward execute() throws Exception
{
        if ( request.getParameter( mapping.getParameter() ) == null )
        {       
        ...
        }
}

The parameter is not null for hyperlinks and buttons but not for
a combo box.

In my JSP I have a combo box and I would like to update the form
when the selection change to do this I should pass a parameter
method which should be equals to update:

<script>
function updateForm(form) {
        form.action='/myLookupDispatchAction.do?method=update'; 
        form.submit();
        return true;
}
</script>
<html:select onchange=updateForm(document.forms[0]);/>

I don't understand how it works.
In my setupLookupDispatchAction I test request.getParameter("method")
in the JavaScript I set the parameter for the action not the request
then I is normal that in the execute method this parameter is null.

It is probably not the best way to set action it will be better to use
hidden field.
Do you have an example for what I try to do ?

Thanks in advance







-----Original Message-----
From: Paul McCulloch [mailto:[EMAIL PROTECTED]
Sent: 12 May 2004 11:12
To: 'Struts Users Mailing List'
Subject: RE: Action parameter and JavaScript


Do you have mutiple forms on the page? Your JS function takes an argument
which it ignores and always sets the action of 'myForm'.

Try debugging with a JS alert just before you submit, showing the action
value for your action.

Having said all that, I would set the method via a hidden field on your form
rather than modifying the action.

HTH,

Paul

> -----Original Message-----
> From: Heligon Sandra [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 12, 2004 8:42 AM
> To: '[EMAIL PROTECTED]'
> Subject: Action parameter and JavaScript
> 
> 
> I use a JavaScript in a form to set an action.
> But I am the following problem, I should pass
> a parameter to the action. I would like to know 
> the syntax.
> 
> Here is my code:
> 
> <script>
> 
> function updateForm(form) 
> {
>       myForm.action='/myLookupDispatchAction.do?method=newSVC_One';   
>       myForm.submit();
>               return true;
> }
> 
> </script>
> 
> <html:select onchange="updateForm(document.forms[0]);"/>
> 
> At the runtime when the combo box change the parameter method 
> is null.
> I tried document.forms[0].method.value="newSVC_One";
> but it does not work.
> 
> Thanks a lot in advance
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


**********************************************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not copy or deliver this message to
anyone. In such case, you should destroy this message, and notify us
immediately. If you or your employer does not consent to Internet email
messages of this kind, please advise us immediately. Opinions, conclusions
and other information expressed in this message are not given or endorsed by
my Company or employer unless otherwise indicated by an authorised
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being
transmitted via electronic mail attachments we cannot guarantee that
attachments do not contain computer virus code.  You are therefore strongly
advised to undertake anti virus checks prior to accessing the attachment to
this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for
loss or damage howsoever caused.
**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to