on click of the icon from the parent window i will popup a textarea using jquery.. I will enter text in the popup on submit i need to set the value in the form property.. I am not able to do it.. Any help would be appreciated. I am using struts tags in jsp.
function showPopup(){
$("#popup").dialog('open');
$("#popup").dialog({
bgiframe: false,
autoOpen:true,
resizable:true,
modal: true,
position: 'center',
height: 150,
width: 300,
buttons: {
'Cancel': function() {
$(this).dialog('close');
},
'Add/Update': function() {
$("button").click(function () {
var text = $('textarea').text();
$("justificationComments").val(text); // this line is not working. text is printed properly.
alert(text);// need to set this text value in justificationcomments property
});
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
Also, it's important to TellTheDetails -- see ItDoesntWorkIsUseless. You may also use the "styleId" attribute to create an HTML "id" attribute on the input element and access it that way.
In this case, it's important to provide us the rendered HTML, not the JSP: ultimately, all the browser sees is HTML, and that's all jQuery can act on.
Paranidharan Selvaraj
Greenhorn
Joined: Mar 19, 2010
Posts: 17
posted
0
Sorry guys.. i m a newbie.
I am using struts(ver 1.2) forms. i have a property which is a list.
<code>
<logic:iterate id="accounts" name="counterpartyForm" property="accounts" type = Account" >
</code>
I have an icon on click i open a popup using jquery.
<code>
<img src="icon.jpg" onclick="showPopup()">
</code>
<script>
function showPopup(){
$("#popup").dialog('open');
$("#popup").dialog({
bgiframe: false,
autoOpen:true,
resizable:true,
modal: true,
position: 'center',
height: 150,
width: 300,
buttons: {
'Cancel': function() {
$(this).dialog('close');
},
'Add/Update': function() {
var text = $('textarea').text();
var area = document.getElementsByName('accounts.justificationComments');
area.value = text;
$(this).dialog('close');
}
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button. Code tags look like this: "[code]" as explained in the link. Thanks!
Since your question is primarily one about JavaScript, I'll leave this question in this forum--but rather than giving us a JSP fragment, post the rendered HTML instead, since ultimately that's all the browser sees, and many people in this forum may be unfamiliar with Struts and its custom tags.