Groups | Blog | Home
all groups > coldfusion flash integration > january 2007 >

coldfusion flash integration : Actionscript & changing form field values


Velaria
1/22/2007 5:49:01 PM
I am building a form using flash forms. I have a particular field that by
default the value is 0.00. I want to make an onchange actionscript that will
dynamically change the form field value to 0.00 if the end user deletes the
value out of the field and leaves it blank.

Please be gentle...I know my actionscript'ing is poor (and probably looks a
wee bit more like JS than AS) LOL

<cfsavecontent variable="zero_myfield>
if (myfield.text == '') {
myform.myfield.text == "0.00";
}
</cfsavecontent>

<cfinput type="text" name="myfield" onchange="zero_myfield">

I know you can manipulate the value of a form field easily with javascript,
but how to do the same thing with actionscript? Any pointers would be
appreciated!

Thanks!!
Dinghus
1/22/2007 10:13:41 PM
Wow. That is definitly NOT AS. LOL

I think the best way to do it is add a listener to the text box and when it
changes do a function call to see if it is blank. If it is blank then insert
the 0.00

I could write out the code for you but I'm in a hurry right now. So if you
can't figure it out by the time I get back here, I'll see what I can do. :)
Velaria
1/23/2007 1:59:56 PM
ROFL, I figured as much...like I said, my AS is *very* rudimentary right now
heheh

I picked up an AS book yesterday evening to hopefully help me out some, I know
not all AS is available to use in CF flash forms, but it will give me a good
reference I hope.

I'll try my hand at the listener and see what I can come up with. Thanks for
the pointer!! :)
The ScareCrow
1/23/2007 11:56:41 PM
No need for a function, just do it in the tag

<cfinput type="Text" name="txt" value="0.00" onchange="if(txt.text == ''){txt.text = '0.00'}">

Velaria
1/24/2007 2:34:19 PM
WOOOOOHOOOOO!! You are the man Ken...many thanks!!

(and to think it was so simple...this is what happens when a blonde overthinks her code!!)

AddThis Social Bookmark Button