# \[MX\] If character exist in text?

**URL:** https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142
**Category:** Uncategorized
**Created:** [July 20, 2003, 4:39am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142 "2003-07-20T04:39:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![aussie\_devil](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@aussie\_devil](https://forum.kirupa.com/u/aussie_devil)
#### Post date: [July 20, 2003, 4:39am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142/1 "2003-07-20T04:39:16Z")

</div>

How would I do this…

For example if I had an input field and i could not allow the characters like \<\*\*space\> and ony \<\*\*underscore “\_”\> how would I do this??

I am guessing you would have to somehow check through ecach character to see if it was a " " with an if else statement… but that would take forever… so… =S

Thanks in advance… =D

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2003, 4:50am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142/2 "2003-07-20T04:50:24Z")

</div>

[AS]myText.restrict = "^ ";[/AS] Where myText is your textfield insance name. This allows the user to enter any character except a blank space.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2003, 5:39am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142/3 "2003-07-20T05:39:14Z")

</div>

hi…

hmm… i not sure that really worked… but i clicked on like the reference button and there was all stuff there about the script type… so it must work… maybe you can tell me what i am doin wrong… i will attach a sample…

i wasnt really sure where i should put the script either?? and is there like some extra script too??

Thanks…

-Scott

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2003, 5:42am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142/4 "2003-07-20T05:42:42Z")

</div>

Here

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2003, 5:44am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142/5 "2003-07-20T05:44:23Z")

</div>

aha… the name should be in the instance not the var… aha… i get it… thanks… =D

-Scott

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2003, 5:48am UTC](https://forum.kirupa.com/t/mx-if-character-exist-in-text/26142/6 "2003-07-20T05:48:20Z")

</div>

No problem 😉
