# Setting variable property for dynamically created textfield

**URL:** <https://forum.kirupa.com/t/setting-variable-property-for-dynamically-created-textfield/132100>\
**Category:** Uncategorized\
**Created:** [December 23, 2004, 12:39am UTC](https://forum.kirupa.com/t/setting-variable-property-for-dynamically-created-textfield/132100 "2004-12-23T00:39:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![russ92176](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@russ92176](https://forum.kirupa.com/u/russ92176)\
**Post date:** [December 23, 2004, 12:39am UTC](https://forum.kirupa.com/t/setting-variable-property-for-dynamically-created-textfield/132100/1 "2004-12-23T00:39:03Z")

</div>

i’m creating a completely dynamic form. i want to assign a variable name to a textfield and then pass that variable with a LoadVars() object.

here’s a small piece of code i can’t get working:

//create movieclip (used like a form)  
\_root.createEmptyMovieClip( ‘dialog\_body’, 0 );

//create textfield input  
dialog\_body.createTextField( answer, 50, 500, 150, 100, 30 );  
dialog\_body[answer].type = “input”;  
dialog\_body[answer].border = true;  
dialog\_body[answer].variable = “fname”; //id will be 1 - 400

// lname is a textfield created using the stage, and the properties window  
// putting ‘lname’ as the var.

//when button is clicked  
mybutton.setClickHandler( “OnClick” );

function OnClick() {  
trace( dialog\_body[“fname”] ); //traces the correct value  
trace( lname ); //traces the correct value  
dialog\_body.removeMovieClip();

```
//simple test script prints all the recieved variables        
getURL( 'testing.php', 0, 'post' );

```

}

problem / question: my test script ‘testing.php’ doesn’t have any knowledge of dialog\_body[“fname”], why?

it prints:  
FUIComponentClass=[type Function]  
FPushButtonClass=[type Function]  
OnClick=[type Function]  
i=0  
lname=smith

— where is fname?

bottomline: if i create a textfield using the traditional method and assign the ‘var’ it works fine. if i create a textfield dynamically at run time, and use the \*.variable property, the variable is NOT sent…why? and how?

thanks for any (much needed) help.
