Hey - really hoping someone can help me here after a few hours trawling several forums and posts… I am stumped.
I have a fairly simple form built in as2 using an input text box that users can enter text, edit and save to a database.
90% of the time this works fine. But during testing of the form it was noticed that some of the time the sendAndLoad fails - either never changes to a successful onLoad or no response on pressing the Save button.
I have noticed that if simple text is entered and saved - no problems.
But if the user presses Enter or skips a few lines it all goes pair shaped when trying to save!
Is there something I am missing or is this in the nature of sendAndLoad to be a bit unpredictable?
The ASP I am communicating with is fairly straight forward and has been re-used several times. It just returning a number to say that the text has been updated in the database.
Anyway - here is my code:
save_btn.onPress = function() {
TransferText = escape(my_txt.htmlText);
var result_lv = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
var SuccessString:Number = result_lv.Success;
if (SuccessString>0) {
EnoteSaved = true;
Error_mc.gotoAndStop("SaveSuccess");
Error_mc._visible = true;
_root.EnotesArrayEnotesID[_root.CurrentPage] = result_lv.Success;
} else {
if (SuccessString<-1) {
Error_mc.gotoAndStop("SaveErrorText");
Error_mc._visible = true;
} else {
Error_mc.gotoAndStop("SaveError");
Error_mc._visible = true;
}
}
} else {
_root.JDTraceAG.text += "
Error connecting to server-45";
Error_mc.gotoAndStop("SaveError");
Error_mc._visible = true;
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.sendAndLoad(_root.SiteURL+"functions/functions.asp?intToDo=45&chrParams="+_root.idUser+"^"+_root.idCourse+"^"+_root.ExternalTopicID+"^"+_root.CurrentPage+"^"+TransferText, result_lv, "POST");
//CS-end
};
Thank you for any help or pointers ye can give!
Joe