• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help required in jquery

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
});

$(this).dialog('close');

}

}
});
}

<form>
<img src="<%= request.getContextPath() %>/images/commentsicon.jpg" onclick="showPopup()">
<div id="popup" class="ui-widget-content ui-corner-all" title="Add Justification Comments" style="display:none" >
<html:textarea name="accounts" property="justificationComments" style="width:250px" indexed="true"/>
</div>
</form>
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The property tag in struts is equivalent to the name tag.

Perhaps you could try adding the name attribute
eg.
$("textarea[name='justificationComments']).val(text);
 
Paranidharan Selvaraj
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have tried your solution.. not working. any suggestions
 
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mate, for cases such as this.

I used a tool such as firebug and firefinder.
Makes debugging act like a charm..

Also, use code tags when posting questions. You'll get more responses from the guru's here..
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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');
}

}
});
}
</script>


<code>
<div id="popup" class="ui-widget-content ui-corner-all" title="Add Justification Comments" style="display:none" >
<html:textarea name="accounts" property="justificationComments" style="width:250px" indexed="true"/>
</div>

The problem is i am not able to set the textarea value in the property.. Please suggest me a solution.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic