Here is what I have found to work:
I think there might be a bug though

<script language="javascript">
function submitForm()
{
 document.forms[0].submit();
 return ( true );
}
</script>


  <form:select property="firmId"
   ondblclick="javascript:submitForm()"
   onchange="javascript:submitForm()" >

   <BR>
   <form:options collection="firms" property="value" labelProperty="label" />
  </form:select>

Populating the options was a little tricky.

The bug comes from the use of:
  <html:submit>
   <bean:message key="button.insert"/>
     </html:submit>

This tag adds a submit object to the document.forms[0]
this causes (netscape at least)  to report document.forms[0].submit()  no such
method
To fix this  use  <input type="submit"> instead of   <html:submit>
<bean:message key="button.insert"/>     </html:submit>

There might be another way around this problem.
Has any one else seen this?

-Dave


Wolfgang Frank wrote:

> Hello there,
>
> may someone help me please?
>
> I tried to call a javascriptfunction from a Struts-Form. I need
> to do this because I want to calculate values in another SELECT
> box depending
> on the choice of this one ... and because a value changed event
> in a form doesn�t cause a submit ... i need this?!
>
> And i can�t get it to work:
>
> <html:form action="assignDocument.do" >
>       <table>
>         <tr>
>           <td>Choose:</td>
>           <td>
>               <html:select property="typeId" size="1"
> onchange='document.forms[0].submit()'>
>                   <html:options collection="typeRefCodes"
> property="refC" labelProperty="refT"/>
>                </html:select>
>           </td>
>         </tr>
>
> ....
>
> </html:form>
>
> I get an javascript error that "submit" is not a function.
>
> Does anybody have an idea. It works fine without the javascript
> and everything seems to be configured properly.
>
> Thanks in advance
> Wolfgang
>
> ------------------------------------
> Herr Dipl. Math. Wolfgang Frank
> Email: [EMAIL PROTECTED]
> ------------------------------------
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
Thank you,
David Lauta
[EMAIL PROTECTED]
(561)272-2698
(561)289-0502 cell

Reply via email to