sendAndLoad "undefined"

Writing from Flash to database with PHP

Page 1 of 1

2 Replies - 3870 Views - Last Post: 18 December 2011 - 03:38 PM

#1 drgnfly1007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-May 08

sendAndLoad "undefined"

Posted 29 July 2008 - 10:25 PM

I am modifying a guestbook that allows the user to enter info. into fields and then it sends it to a database. All the entries are also written to a text field in the same swf so they can be viewed.

I am trying to modify it so that it can be used as a submission form for a client. Everything works fine until I hit the submit button and the status field "gb_status" sends the message "undefined". Does anyone know what the coding error is? I have referenced toward the end of the code where it sends back the massage "undefined".

"write" is the name of the movie clip that the form is contained in.

This code is on the submit button itself not the action layer.

Thanks for the help.





on(click){
/*
Modify these reference paths to yours if you
have changed them. Also modify gb_status
reference path if required
*/
company = _parent._parent.write.company.text;
contact = _parent._parent.write.contact.text;
youremail = _parent._parent.write.youremail.text;
phone = _parent._parent.write.phone.text;
permit = _parent._parent.write.permit.text;
address = _parent._parent.write.address.text;
city = _parent._parent.write.city.text;
states = _parent._parent.write.states.text;
zip = _parent._parent.write.zip.text;


// Check variable data
if (company eq "") {
_parent._parent.write.gb_status.text = "Required: Company";

} else if (contact eq "") {
_parent._parent.write.gb_status.text = "Required: Contact Name";

} else if (youremail eq "") {
_parent._parent.write.gb_status.text = "Required: Email Address";

} else if (!youremail.length || youremail.indexOf("@") == -1 || youremail.indexOf(".") == -1) {
_parent._parent.write.gb_status.text = "Required: Valid Email Address";

} else if (phone eq "") {
_parent._parent.write.gb_status.text = "Required: Phone Number";

} else if (permit eq "") {
_parent._parent.write.gb_status.text = "Required: Resale Permit";

} else if (address eq "") {
_parent._parent.write.gb_status.text = "Required: Address";

} else if (city eq "") {
_parent._parent.write.gb_status.text = "Required: City";

} else if (states eq "") {
_parent._parent.write.gb_status.text = "Required: State";

} else if (zip eq "") {
_parent._parent.write.gb_status.text = "Required: Zip";


} else {
_parent._parent.write.gb_status.text = "Please wait...";
newEntry = new LoadVars()
newEntry.ref = this
newEntry.submit = "Yes"
newEntry.company = company
newEntry.contact = contact
newEntry.youremail = youremail
newEntry.phone = phone
newEntry.permit = permit
newEntry.address = address
newEntry.city = city
newEntry.states = states
newEntry.zip = zip

newEntry.sendAndLoad("GuestBook.php?action=write&r="+random(999), newEntry, "POST")
newEntry.onload = function(success){


if(success){


//The next line is where the status "undefined" is sent back to the Dynamic text box gb_status

_parent._parent.write.gb_status.text = this.gb_status;
_parent._parent.read.loadEntries("Default", 10);
// Clear fields
_parent._parent.write.company.text = "";
_parent._parent.write.contact.text = "";
_parent._parent.write.youremail.text = "";
_parent._parent.write.phone.text = "";
_parent._parent.write.permit.text = "";
_parent._parent.write.address.text = "";
_parent._parent.write.city.text = "";
_parent._parent.write.states.text = "";
_parent._parent.write.zip.text = "";





}
}
}
}

Is This A Good Question/Topic? 0
  • +

Replies To: sendAndLoad "undefined"

#2 BetaWar  Icon User is offline

  • #include "soul.h"
  • member icon

Reputation: 1148
  • View blog
  • Posts: 7,145
  • Joined: 07-September 06

Re: sendAndLoad "undefined"

Posted 30 July 2008 - 10:48 PM

So I am assuming that you are echoing or returning or sending back the variable (sorry haven't actually used sendAndLoad as of yet) like so:

gb_status = Message and stuff?

If so I think the problem is that you need to have an & in front of variable names otherwise it is seens as undefined.

so try something like this:

&gb_status = Message and stuff

Here is where I got my info:
http://livedocs.adob...e=00001790.html

Also, in the future please place your code inside of these tags:

[code] Place Code Here [/code]

It just makes everything easier to read.

Hope that helps
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10562
  • View blog
  • Posts: 39,086
  • Joined: 27-December 08

Re: sendAndLoad "undefined"

Posted 18 December 2011 - 03:38 PM

Closing this thread since it is attracting a lot of spam.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1