# How to test for no text in an input field

**URL:** <https://forum.kirupa.com/t/how-to-test-for-no-text-in-an-input-field/314759>\
**Category:** Uncategorized\
**Created:** [October 7, 2010, 8:59pm UTC](https://forum.kirupa.com/t/how-to-test-for-no-text-in-an-input-field/314759 "2010-10-07T20:59:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EpiPenguin](https://avatars.discourse-cdn.com/v4/letter/e/6bbea6/32.png) [@EpiPenguin](https://forum.kirupa.com/u/EpiPenguin)\
**Post date:** [October 7, 2010, 8:59pm UTC](https://forum.kirupa.com/t/how-to-test-for-no-text-in-an-input-field/314759/1 "2010-10-07T20:59:33Z")

</div>

I’ve never actually tried to work in Input field before haha.

BE AWARE: This is a noob question :] I’m learning, still.

All i need to do is when a button is pressed, make sure there is text inside of the input field. If there isn’t, declare the log-in to be false.

Here’s what I have so far.

```auto
var loginUser:String;
var loginPass:String;
var loginAccepted:Boolean;

heroName.restrict = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Login.addEventListener(MouseEvent.CLICK, checkLogin);
function checkLogin(e:MouseEvent){
	loginUser = heroName.text;
	
	
	trace(loginUser);
}

```
