PDA

View Full Version : sending data to cfm


cezanne
10-11-2005, 04:22 PM
I have been playing with some code I found, but I'm unclear on something, when I type "_root.whatever.text;" what is the "text" refering too? is that the indicator of the type of data? What if I have a calendarpicker or a combobox? is that the same still?

Sorry, but I'm pretty new at this part:


on (release) {
thedata = new loadVariables();
thedata.SpecialistName = _root.SpecialistName.text;
thedata.prName = _root.prName.text;
thedata.org = _root.org.text;
thedata.startDate = _root.startDate.text;
thedata.paDate = _root.paDate.text;
thedata.cType = _root.cType.text;
thedata.dollarAmount = _root.dollarAmount.text;


thedata.onLoad = function(success){
if(success){
_root.success.text = this.remark;
}
}
thedata.sendAndLoad("DBSend.cfm",thedata,"POST");

}

Paerez
10-11-2005, 06:31 PM
From actionscript dictionary:
TextArea.text
Availability
Flash Player 6 (6.0 79.0).

Edition
Flash MX 2004.

Usage
textAreaInstance.text

Description
Property; the text contents of a TextArea component. The default value is "" (an empty string).

Example
The following code places a string in the myTextArea instance, and then traces that string to the Output panel:

myTextArea.text = "The Royal Nonesuch";
trace(myTextArea.text); // traces "The Royal Nonesuch"


Use the AS Dictionary. Its your friend.

cezanne
10-11-2005, 07:41 PM
so is the way I have this coded correct, or is this going to cause some problems?

If I have a combobox as one of the input fields, should it be changed from .text to something else?

Paerez
10-11-2005, 07:46 PM
_root.SpecialistName.text;

This would be refering to a text area or a text field's text box. So if I had a box called SpecialistName on root, doing:

_root.SpecialistName.text = "Billy";

the text box would contain the text billy.

In your case, I think you are backwards.

thedata = new loadVariables();
// Like this:
_root.SpecialistName.text = thedata.SpecialistName;

Artech
10-11-2005, 09:21 PM
Regarding your question about .text is usually only used for textboxes.

The easiest way to get the current value of a combobox is instancename.getValue();
its a built in function to the combobox class provided by macromedia (assuming that's the combobox you're using).

I have not used the macromedia calendar with their UI components 2. I assume that's the one you're using. I went through the code of that component and it appears what you would be looking for is

instancename.getSelectedItem();


instancename.getSelectedItems();

depending on how many days you're looking for the calendar to deal with.

I normally don't use .text in situations like what appears you're doing.

if you have a input box I usually put a variable name in there and just use the variable name. Actionscript makes it so that textbox.text and the textbox's variable are instrinsicly linked. The main difference is that if you change scenes and the textbox is no longer there, you can't call it in the code, but you can set up the scope of variable such that you can use it anywhere in the movie.

Hope that helped,

Brian