# \[Solved\] Special characters are not checked and skipped?

**URL:** https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395
**Category:** Questions about Thunkable X
**Tags:** help
**Created:** [December 8, 2023, 1:50pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395 "2023-12-08T13:50:10Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![meko137](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meko137](https://community.thunkable.com/u/meko137)
#### Post date: [December 8, 2023, 1:50pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/1 "2023-12-08T13:50:10Z")

</div>

I wonder how it is possible in my function, if I enter a special character in the input field username, that this does not give my intended error message but simply skips and executes the else?

I’m scratching my head because it works in my create password input field but not here for a simple username?

Here is the “buggy” code:

 ![2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/3/43bad86d86d88894a19a51f99f6b06e1ffe48836.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [December 8, 2023, 3:41pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/2 "2023-12-08T15:41:30Z")

</div>

Which character causes the condition to be false? Is that character listed in the `does contain` block?

Can you post a link to your project?

---

<div class="post-metadata">

### Author: ![meko137](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meko137](https://community.thunkable.com/u/meko137)
#### Post date: [December 8, 2023, 4:02pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/3 "2023-12-08T16:02:17Z")

</div>

I still don’t get it… tried other things but still the same… not checking the special characters

here is my project: [Thunkable](https://x.thunkable.com/projectPage/65613db2eb290796092de2dc)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [December 8, 2023, 4:50pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/4 "2023-12-08T16:50:14Z")

</div>

> [@tatiang](#):
>
> Which character causes the condition to be false? Is that character listed in the `does contain` block?

Without this information, it’s really hard to help you.

---

<div class="post-metadata">

### Author: ![meko137](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meko137](https://community.thunkable.com/u/meko137)
#### Post date: [December 8, 2023, 4:55pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/5 "2023-12-08T16:55:03Z")

</div>

> [@tatiang](#):
>
> Which character causes the condition to be false? Is that character listed in the `does contain` block?

any character of this: !"#$%&'()\*+,-./:;\<=\>?@^\_`{|}~

Mostly I’m testing with the “!”

---

<div class="post-metadata">

### Author: ![meko137](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meko137](https://community.thunkable.com/u/meko137)
#### Post date: [December 8, 2023, 4:56pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/6 "2023-12-08T16:56:28Z")

</div>

At least, I just want that a new user needs to create a username with only letters and numbers but don’t special characters

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [December 8, 2023, 5:03pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/7 "2023-12-08T17:03:45Z")

</div>

Okay, here’s the problem with your code. I find it confusing to use the `not` block. I understand why you did but your IF condition says if there is not a symbol, display an error message; if there is a symbol, allow the username.

Your current blocks have added a NOT block when compared to the screenshot you posted above:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/b/8bb3fb6d90aa27f023e9d36f06417d8805d8de58.png)

I would much rather have an IF condition that says if the string of symbols contains the current letter of the text input, display an error message; ELSE, allow it.

The other problem with your code is that you are running a loop to check each letter but all that matters is the last letter of the username they entered. A loop like that will check each letter but will think #####M is valid while MMMM# is not.

Instead, you need to set a variable to false and then run the loop and change only the value of the variable to true if a symbol is found (and then break out of the loop if you wish to be more efficient). Then after the loop has completed, you check to see if that variable is still false which means the username is valid or is true which means a symbol was found. And then based on that variable value, you display a message to the user.

---

<div class="post-metadata">

### Author: ![meko137](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meko137](https://community.thunkable.com/u/meko137)
#### Post date: [December 8, 2023, 5:08pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/8 "2023-12-08T17:08:50Z")

</div>

hmm ok thanks

I just removed the NOT block and having the same issue

but let me try your idea with setting a variable to false or true and then return the value

Thank you for the first tatiang

---

<div class="post-metadata">

### Author: ![meko137](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meko137](https://community.thunkable.com/u/meko137)
#### Post date: [December 8, 2023, 5:17pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/9 "2023-12-08T17:17:16Z")

</div>

It works tatiang! So you so much for your thinking and helping.

Here is the solution:

 ![Capture](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/4/f4f0e9b2270cd0f1069725efdeeee08a94d4021e.png)

As you said, working with boolean true and false makes it to work

Topic can be closed

---

<div class="post-metadata">

### Author: ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)
#### Post date: [December 8, 2023, 6:09pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/10 "2023-12-08T18:09:11Z")

</div>

FYI, topics can be marked as solved by clicking on the check mark below the reponse that solves this issue.

 ![Screenshot 2023-12-08 at 1.08.10 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/b/6b55d9819df2107d5c284189685090237e048781.png)

---

<div class="post-metadata">

### Author: ![matt\_conroy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/matt_conroy/32/150843_2.png) [@matt\_conroy](https://community.thunkable.com/u/matt_conroy)
#### Post date: [December 8, 2023, 6:09pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/11 "2023-12-08T18:09:15Z")

</div>



---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [December 8, 2023, 7:02pm UTC](https://community.thunkable.com/t/solved-special-characters-are-not-checked-and-skipped/2743395/12 "2023-12-08T19:02:38Z")

</div>

You’re welcome!

I have something for you to consider next time you need to check a username or password for valid characters. The way you are doing it is fine but it’s time-consuming to set up.

Here’s another method that uses fewer blocks:

Project link (see the first screen): [Thunkable](https://x.thunkable.com/copy/65a6d577171032fce6bb805ddad0cf82)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/7/d72ecaf46f9117e99bf6fa15f36f5038f5269545.png)
