# Is it possible to test value of dynamic text field

**URL:** <https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192>\
**Category:** flash\
**Created:** [March 24, 2006, 2:55pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192 "2006-03-24T14:55:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jflint](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jflint/32/2115_2.png) [@jflint](https://forum.kirupa.com/u/jflint)\
**Post date:** [March 24, 2006, 2:55pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/1 "2006-03-24T14:55:16Z")

</div>

I want to be able to do an if/else statement to test the value of a dynamic text field. The value will always be either yes or no. So, for instance,

```auto
 if textfield.value = "yes" then
 do something
else if textfield value = "no" then
 do something different
end if

```

Is that something that is possible? What would the syntax be? The dynamic text field is being populated from an external text file.

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 24, 2006, 3:12pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/2 "2006-03-24T15:12:13Z")

</div>

```auto
if (textfield.text == "yes") {
 //then do something
} else if (textfield.text == "no") {
 //then do something different
}

```

---

<div class="post-metadata">

**Author:** ![11113](https://avatars.discourse-cdn.com/v4/letter/1/e9c0ed/32.png) [@11113](https://forum.kirupa.com/u/11113)\
**Post date:** [March 24, 2006, 3:27pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/3 "2006-03-24T15:27:33Z")

</div>

aww man, an actionscript question i can finally answer and you beat me to it!  
I’ll get there next time!:pir:

btw, you have to give your dynamic textbox an instance name, here’s an example for one named yesOrNo.  
 ![](http://img123.imageshack.us/img123/5764/untitled1copy6ks.jpg)  
if(yesOrNo.text == “yes”){  
trace(“The box says yes!”);  
}  
else if(yesOrNo.text == “no”){  
trace(“The box says no!”);  
}

… how do you enter actionscript code into kirupaforum?

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 24, 2006, 3:29pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/4 "2006-03-24T15:29:11Z")

</div>

> [@~§~](#):
>
> aww man, an actionscript question i can finally answer and you beat me to it!

Ya, but you have a picture :thumb:

AS tags are [noparse]

```auto

```

[/noparse]

---

<div class="post-metadata">

**Author:** ![11113](https://avatars.discourse-cdn.com/v4/letter/1/e9c0ed/32.png) [@11113](https://forum.kirupa.com/u/11113)\
**Post date:** [March 24, 2006, 3:30pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/5 "2006-03-24T15:30:28Z")

</div>

hey, canadian, i have an idea! Can you answer MY question I had two days ago? Here! [http://www.kirupa.com/forum/showthread.php?t=213102](http://www.kirupa.com/forum/showthread.php?t=213102)  
Cool, i’ll ActionScript Code:  
[FONT=Courier New][LEFT]have to [COLOR=#0000FF]try[/COLOR] [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]another[/COLOR] [COLOR=#0000FF]time[/COLOR]!  
[/LEFT]  
[/FONT]

we sure do edit our posts a lot! … aw man the forums caught my edit!

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 24, 2006, 3:38pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/6 "2006-03-24T15:38:11Z")

</div>

lol… the “else if” is not necessary, for it only has two values, you can use just plain “else” like Canadian said. But since were spamming this guy with answers:

```auto
 textfield.text == "yes" ? /*then do something if yes*/ : /*then do something if no*/

```

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 24, 2006, 5:47pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/7 "2006-03-24T17:47:23Z")

</div>

> [@Defective](#):
>
> lol… the “else if” is not necessary, for it only has two values, you can use just plain “else” like Canadian said. But since were spamming this guy with answers:
> 
> ActionScript Code:  
> [FONT=Courier New][LEFT][COLOR=#0000ff]textfield[/COLOR].[COLOR=#0000ff]text[/COLOR] == [COLOR=#ff0000]“yes”[/COLOR] ? [COLOR=#808080]_/then do something if yes/_[/COLOR] : [COLOR=#808080]_/then do something if no/_[/COLOR]  
> [/LEFT]  
> [/FONT]

What if the value is something other than yes or no?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 24, 2006, 5:48pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/8 "2006-03-24T17:48:36Z")

</div>

> The value will always be either yes or no.

Dont’cha know?🙂

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [March 24, 2006, 5:57pm UTC](https://forum.kirupa.com/t/is-it-possible-to-test-value-of-dynamic-text-field/183192/9 "2006-03-24T17:57:49Z")

</div>

[SIZE=1][COLOR=silver]shutup:worried::pa::ne:[/COLOR][/SIZE]

🙂
