-
Loadvars not working...need help
I am trying to create a phonebook with mx 2004 pro, asp, and sql (access for now) using IE 6 sp2
if i use the following it loads the returning variables into the textbox -but I don't know how i am unable to create an array and send them to a datagrid:
on (release) {
loadVariablesNum("dbphone0.asp?Record=" add myrecord, 0);
myrecord="";
firstName="";
lastName="";
City="";
errorMsg="Please wait";
}
if i use the following i get nothing back:
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
firstName = result_lv.firstName;
} else {
firstName = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.myrecord = myrecord.text;
send_lv.sendAndLoad("dbphone0.asp", result_lv, "POST");
};
submit_button.addEventListener("click", submitListener);
and if I use the following i get my results back in a new IE window:
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
firstName = result_lv.firstName;
} else {
firstName = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.myrecord = myrecord.text;
send_lv.send("dbphone0.asp", "POST");
};
submit_button.addEventListener("click", submitListener);
I have played with it for hours trying to use this.firstName or firstName.text so on and so on the debugger doesn't seem to work (remote debugging with the activex plugin does nothing) the internal one doesn't hit the database to pull the info.
PLEASE HELP!!!!
-
Not 100% sure what it is you're tryin to achieve and without seing the asp code can't be sure where the problem lies. I have noticed one possible error with the query you're sending to the asp file. try:
send_lv.Record = myrecord.text
-
ugoDesigns - During my testing I changed the parameter name in the actionscript and in the ASP file to myrecord, so the two values are correct in the above examples. I just need to know why the values will post to a blank IE window (using send) but not to the current window (using saveandload).
Thanks for responding!
-
FK'n_dog
the problem could be due to scope of the variables
does this produce the correct result ??
Code:
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
getResults();
};
submit_button.addEventListener("click", submitListener);
function getResults(){
lv= new LoadVars();
lv.myrecord = _root.myrecord.text;
lv.onLoad = function() {
firstName = result_lv.firstName; trace(firstName);
};
lv.sendAndLoad("dbphone0.asp", lv, "POST");
};
-
a_modified_dog -
Sorry, but it didn't work. I even tried taking out the andload and the ,lv before the post just to make it a send and that didn't even load the results in a new IE window. It did nothing when i clicked the button.
Thanks for the help though!
-
FK'n_dog
try using a simple button (not a Button component as is indicated by your code)
on(release){
getResults();
}
any results ??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|