| Author |
Beginner needs help please
|
Michael Norman
Greenhorn
Joined: Apr 29, 2005
Posts: 7
|
|
Dear all. I have the following problem. I have the following code: This works fine. BUT... Now I want to change the javascript call from to something like: So I want to call "changeName" with the name of the part I just iterated over. The above dosn't work... But what is the correct code for this? Thanks in advanced for your help greetings Norman
|
 |
Eric Fletcher
Ranch Hand
Joined: Oct 26, 2000
Posts: 188
|
|
Try HTH, E
|
My theory of evolution is that Darwin was adopted. - Steven Wright
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
You have to remember that your code is in a scriptlet, which means that you need to use java syntax, rather than struts tag syntax. The following should work: onChange='<%= "changeName(" + part.getPartName() + ")" %>'
|
Merrill
Consultant, Sima Solutions
|
 |
Eric Fletcher
Ranch Hand
Joined: Oct 26, 2000
Posts: 188
|
|
Oops, merrill is right, missed the getter. Should look like this: Sorry about that! [ June 10, 2005: Message edited by: Eric Fletcher ]
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
A couple more things on this: I just noticed that in order for my suggestion to work, you will also have to add type="<<fully qualified name for the Part class>>" to the logic:iterate tag. Otherwise, the part variable will be of type Object, and you will have to cast it before using its getPartName() methodStruts tags have an "all or nothing" policy toward scriptlets, which means that if you substitute an attribute value with a scriptlet, either all of it has to be in a scriptlet, or no part of it should be a scriptlet. Given this policy, I don't think Eric's suggestion will work in this situation. I hope this helps. [ June 10, 2005: Message edited by: Merrill Higginson ]
|
 |
Michael Norman
Greenhorn
Joined: Apr 29, 2005
Posts: 7
|
|
Hey Merrill and Eric. Thanks for your help, it works now. I had to use the type-attribute of the iterate-tag and the syntax Merrill posted! Greetings, Norman
|
 |
 |
|
|
subject: Beginner needs help please
|
|
|