Problem: JavaScript in StrutsForm

2001-11-29 Thread Wolfgang Frank

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
  tdChoose:/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]




Re: Problem: JavaScript in StrutsForm

2001-11-29 Thread Rob Breeds


Wolfgang

You probably have a html:submit tag? Struts generates a button with a
name of 'submit' so JavaScript gets confused. It wasted so much of my time!

You need to give your submit button a different name - can't recall how to
do that right now because I stopped using the submit buttons and used links
instead

Rob Breeds





   

Wolfgang Frank 

wolfgang.fran   To: [EMAIL PROTECTED]

[EMAIL PROTECTED]   cc:   

 Subject: Problem: JavaScript in 
StrutsForm
29/11/2001 

13:00  

Please respond 

to Struts 

Users Mailing  

List  

   

   





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
  tdChoose:/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]





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




Re: Problem: JavaScript in StrutsForm

2001-11-29 Thread Wolfgang Frank

Hi David and Rob  everybody !

Thanks for your help!

Your ideas were right. The problem is caused by the html:submit tag at the end of
the form.
I can still use this strus submit tag, when i give it a different 'propertyname'
than 'submit' - which ist the
default value.

Here ist the code that works:

html:form action=assignDocument.do 

html:select property=typeId size=1  onchange=submitForm()
 html:options collection=typeRefCodes property=refC
labelProperty=refT/
 /html:select

html:submit property=newbean:message
key=FORM_global.button_new//html:submit

/html:form

Thanks once again and bye
Wolfgang

 
 Herr Dipl. Math. Wolfgang Frank
 Email: [EMAIL PROTECTED]


##

Wolfgang

You probably have a html:submit tag? Struts generates a button with a
name of 'submit' so JavaScript gets confused. It wasted so much of my time!

You need to give your submit button a different name - can't recall how to
do that right now because I stopped using the submit buttons and used links
instead

Rob Breeds




David Lauta wrote:

 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
tdChoose:/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


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