I’ve been able to get my autosave to work fine for input boxes and select boxes. I’m trying to use the same process for textareas but it’s not working for me. I’m not sure if the same process can be used. I also have tinymce as an htmleditor for my textareas so I’m not sure if that’s causing an issue.
Here’s an example of my code. I’m doing this within a classic ASP page.
<textarea id="Com<%=QuesID%>" row= "1" cols= "120" name="Com<%=QuesID%>" QuesID=<%=QuesID%> wrap tabindex="21" rows="10" class="formTxt"><%=TempTxt%></textarea>
Then at the bottom of the page:
<script>
$(document).ready(function(){
$('select').live('change',function () {
var itemValue = escape($(this).val());
var itemName = $(this).attr('name');
var QuesID = $(this).attr('QuesID');
var typeID = "select";
//alert(statusVal);
$.ajax({
type: "POST",
url: "PAFormAJAX.asp",
data: 'itemValue=' + itemValue + '&itemName=' + itemName + '&QuesID=' + QuesID + '&typeID=' + typeID,
success: function(msg) {
$('#autosavenotify').text(msg);
}
})
});
$('input').live('change',function () {
var itemValue = escape($(this).val());
var itemName = $(this).attr('name');
var QuesID = $(this).attr('QuesID');
var typeID = "input";
//alert(statusVal);
$.ajax({
type: "POST",
url: "PAFormAJAX.asp",
data: 'itemValue=' + itemValue + '&itemName=' + itemName + '&QuesID=' + QuesID + '&typeID=' + typeID,
success: function(msg) {
$('#autosavenotify').text(msg);
}
})
});
$('textarea').live('change',function () {
var itemValue = escape($(this).val());
var itemName = $(this).attr('name');
var QuesID = $(this).attr('QuesID');
var typeID = "textarea";
//alert(statusVal);
$.ajax({
type: "POST",
url: "PAFormAJAX.asp",
data: 'itemValue=' + itemValue + '&itemName=' + itemName + '&QuesID=' + QuesID + '&typeID=' + typeID,
success: function(msg) {
$('#autosavenotify').text(msg);
}
})
});
});
</script>
The saving was working fine for inputs and select boxes, so I’ll leave out the PAFormAjax.asp code. Am I able to autosave with textareas like this? If not, do you have any tips for what I need to change?
Thanks for any help!
Try using
for textareas