I'm confused here.  Is it your intent to pass a variable 'what' from your
form to the action?

I think the problem is that you need to assign the value what to a hidden
element

<html:hidden property="cpKey"/>

then in your java script assign the value to the value of the hidden element

document.form.cpKey.value = what;

then if your form as the proper setters and getters for cpKey you can get
the value in your action method.

Hope this helps

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 12, 2006 4:20 AM
To: user@struts.apache.org
Subject: Submitting forms with javascript in struts



Hello,

I do have a problem, because I don't know how to submit a form with
javascript
in struts.

Normally, I'm submitting forms like this:

<html:form action="somepath">
<html:submit property="myvalue" value="send">
</html:form>

I'm receiving the value with the getter-method getMyvalue() of the
appropriate
ActionForm.



This time, I want to submit the form with a

<a href=javascript:dosubmit("value")>Some text</a>


dosubmit is a function like

<script>
dosubmit(what)
{
      document.formname.value=what;
      document.formname.submit();
}
</script>


The browser submits the form (I'm getting no javascript error), but I don't
get
the value of document.formname.value.


I would be glad to get some help,
kind regards,
Andreas Hartmann


BTW:
Is there a way to send another value in the html:submit - button as this,
which
is displayed to the user?


---------------------------------------------------------------------
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