Well I don't know about the javascript piece but the id on your input is
invalid. Your input should look something like this:
<input type="text" name="map['ID'].input" id="TestAction_map_ID_input" />
Shoaib Gauhar wrote:
Thanks for the reply. Actually the code which i have
posted is valid for any other component than
inputtransferselect and maybe other transfer select
components. When the page is rendered it generates the
following code:
<input type="text" name="map['ID']_input"
id="TestAction_map_'ID'__input"/>
</td>
<td valign="middle" align="center">
<input type="button"
value="->"
onclick="addOption(document.getElementById('TestAction_map_'ID'__input'),
document.getElementById('TestAction_map_'ID'_'))"
/><br /><br />
<input type="button"
value="<-"
onclick="removeOptions(document.getElementById('TestAction_map_'ID'_'))"
/><br /><br />
<input type="button"
value="<<--"
onclick="removeAllOptions(document.getElementById('TestAction_map_'ID'_'))"
/><br /><br />
</td>
<td>
<label for="rightTitle">ID</label><br />
<select name="map['ID']" size="5"
id="TestAction_map_'ID'_" multiple="multiple">
<option value="1"></option>
<option value="2"></option>
</select>
<input type="button"
onclick="moveOptionDown(document.getElementById('TestAction_map_'ID'_'),
'key', '');"
value="v"
/>
<input type="button"
onclick="moveOptionUp(document.getElementById('TestAction_map_'ID'_'),
'key', '');"
value="^"
/>
It gives a syntax error in javascript. To my
understanding this is caused by the quotes which i am
giving in the map (map['ID']). If we change the
map['ID'] to map[ID] it works fine but my hashmap
implementation doesnt work :(. When the script
generates the code for the onclick() event it doesnt
change the quotes to legal characters and that is the
reason why it generates error and the buttons doesnt
work. It has nothing to do with setters and getters of
HashMap.
Your help will be highly appreciated.
Thanks in advance
Shoaib
--- Dave Newton <[EMAIL PROTECTED]> wrote:
--- Shoaib Gauhar <[EMAIL PROTECTED]> wrote:
http://www.nabble.com/file/p12876594/Source%2BCode.zip
Source+Code.zip
I am attaching my struts.xml, TestAction.java and
test.jsp, in which i have implemented
InputTransferSelect. It generates a java script
error
when the page is rendered.
What JavaScript error? Why isn't there a getter for
the HashMap?
For those that don't want to download the zip file,
here are the relevant portions of the code:
JSP:
<s:form action="TestAction.action">
<s:inputtransferselect name="map['ID']"
label="ID"
value="map['ID']"
list="#{'1','2'}"
theme="ajax"
rightTitle="ID"/>
</s:form>
Java:
public class TestAction extends ActionSupport {
public HashMap map = new HashMap();
public TestAction() {
map.put("ID","1");
}
public String execute() {
return SUCCESS;
}
}
--- Shoaib Gauhar <[EMAIL PROTECTED]> wrote:
http://www.nabble.com/file/p12876594/Source%2BCode.zip
Source+Code.zip
I am attaching my struts.xml, TestAction.java and
test.jsp, in which i have
implemented InputTransferSelect. It generates a
java
script error when the
page is rendered. I am posting this mail for the
second time because the
first time i didnt get any reply (maybe because i
didnt post any code of
mine).
It would be highly appreciable if you could help
me
in this regard.
Shoaib Ahmad
(PS: I need to pass value through HashMap so
please
dont ask me to change
it. Thanks)
--
View this message in context:
http://www.nabble.com/InputTransferSelect-problem-in-Struts-2-tf4514585.html#a12876594
Sent from the Struts - User mailing list archive
at
Nabble.com.
---------------------------------------------------------------------
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]
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search
that gives answers, not web links.
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]