# Capture inputBox 'Cancel'

**URL:** <https://forum.inductiveautomation.com/t/capture-inputbox-cancel/5160>\
**Category:** Ignition\
**Created:** [September 18, 2012, 8:15pm UTC](https://forum.inductiveautomation.com/t/capture-inputbox-cancel/5160 "2012-09-18T20:15:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [September 18, 2012, 8:15pm UTC](https://forum.inductiveautomation.com/t/capture-inputbox-cancel/5160/1 "2012-09-18T20:15:17Z")

</div>

I’d like to capture when a user clicks Cancel on an inputBox. I would have thought this would work:

if retVal != None :  
# do some stuff

However it seems to skip over that like it is returning something then I get an error:  
‘TypeError: len() of unsized object’

Here’s the whole thing:

`user = system.gui.inputBox("Enter username:","")
	if user != None :
		if len(user) > 0 :
			# get password
			pwd = system.gui.passwordBox("Enter password:","User: " + user)
			if len(pwd) > 0 :
				# verify
				ret = system.security.switchUser(user,pwd)
				if ret == 0 :
					# failed
					# system.gui.messageBox("No way!")
					return ''
				else :
					# passed
					#system.gui.messageBox("Yeah")
					#label = window.rootContainer.getComponent('lblUser')
					return user`

---

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [September 18, 2012, 8:29pm UTC](https://forum.inductiveautomation.com/t/capture-inputbox-cancel/5160/2 "2012-09-18T20:29:52Z")

</div>

Actually I I figured it out. Placing an else block and returning something fixed it. Just a bit of a misleading error I guess.
