• 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

Value in the textarea is not retaining in jquery popup modal.

 
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 a popup modal dialogue... The user will be asked to enter the text inside the textarea of the popup. I have edit,save and close buttons.. User clicks edit and changes the text inside the textarea and opts to close without saving. When the user opens the popup again the value in the popup textarea is not retaining. I am using jquery to do this.

'Close': function() {
$('input[type="text"], textarea').attr('readonly','');
$(this).dialog('close');
}


I have tried setting the value again the textarea like
$(this).val("original text"); not succeeding though.
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where and how are you executing the code to re-populate the value. The textarea must exist before trying to fill it in.
 
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 for the delayed reply.. I have a textarea inside a div tag in jsp. On click of an image i use jquery modal dialogue to open the popup.

Jsp Code:

<div id='popup0' class="ui-widget-content ui-corner-all" title="Confidential Comments" style="display:none" >
<textarea name="accounts[0].justificationComments" style="width:480px ;height:150px;border:0px;">test </textarea>
</div>

My problem is i get the textarea in the popup. I am able to save/edit/close the modal window. One bug that is repeatedly bothering me is when i click on edit i am able to edit the content inside but without saving if i click the button close the value is retaining when i open the popup again. It should only happen if is use save button.

buttons: {

'Cancel': function() {
document.getElementById(imageDiv).style.display="none";
document.getElementById(checkboxId).checked=false;
document.getElementById(hiddenId).value= "";
$('input[type="text"], textarea').attr('readonly','');
$(this).dialog('close');
},
'Close': function() {
$('input[type="text"], textarea').attr('readonly','');
$(this).dialog('close');
},
'Save': function() {
var text = $(this).text();
document.getElementById(hiddenId).value= text;
$(":button:contains('Edit')").attr("disabled","");
$(this).dialog('close');
},
'Edit': function() {
$('input[type="text"], textarea').attr('readonly','');
$(":button:contains('Save')").show();
$(":button:contains('Edit')").attr("disabled","disabled");
return;
}
}
});

reply
    Bookmark Topic Watch Topic
  • New Topic