Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-997] hasText crashes if in IF Statement

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-05-04T11:23:08.000+0000
Affected Version/sn/a
Fix Version/sRelease 2.1.0
ComponentsiOS
Labelscore, module_textfield, qe-testadded, training
ReporterRyan G
AssigneeNeeraj Gupta
Created2011-04-15T02:41:09.000+0000
Updated2013-11-07T05:31:54.000+0000

Description

line 116
(name.hasText) will crash. (name.value!='') works fine.

Attachments

FileDateSize
consoleLog.txt2011-08-16T16:28:21.000+00003237
crashLog.txt2011-08-16T16:28:21.000+000046439
setupapp.js2011-04-15T02:41:09.000+00003153

Comments

  1. Sindre Sorhus 2011-04-15

    This is still an issue in Titanium 1.5.1 and iOS 4.2.1.

  2. Vikramjeet Singh 2011-08-16

    Bug Scrub: Valid. Test case required Tested on : Mac OSX Lion TiMob 1.8.0 TiStud: 1.0.4.201108101535 Device: iPhone Simulator
  3. Reggie Seagraves 2011-08-16

    Please attach console log and crash log, then reassign to me.
  4. Vikramjeet Singh 2011-08-16

    Console Log and Crash Log attached.
  5. Jon Ege Ronnenberg 2012-02-21

  6. Stephen Tramer 2012-05-04

    Fixed in master 2.1.0.848d711
  7. Dustin Hyde 2012-06-14

    Closing as Fixed. Verified via modified TIDOC-461 > hasText.js attachment (modified code below). SDK: 2.1.0.v20120613210250 Studio: 2.1.0.201206131907 OS: Snow Leopard Devices Tested: iPhone Simulator 5.0, iPhone4 5.0.1, iPad2 4.3.5 Steps to Test: 1. Run code below.
       var win = Ti.UI.createWindow({ 
       	backgroundColor: '#eee', 
       	title: 'hasText bug'
       });
       
       var containerView = Ti.UI.createView({
       	height:30,
       	width : 100
       });
       
       var textField = Ti.UI.createTextField({
       	height:30,
       	color: '#000',
       	font: {fontFamily:'Helvetica Neue', fontSize:12, fontWeight:'bold'},
       	clearButtonMode: Ti.UI.INPUT_BUTTONMODE_ALWAYS,
       	appearance:Ti.UI.KEYBOARD_APPEARANCE_ALERT,
       	returnKeyType:Ti.UI.RETURNKEY_DONE, //DONE // NEXT // SEND
       	suppressReturn:true,
       	borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
       	width : 70
       });
       
       textField.addEventListener('change', function(e) {
       	try {
       		if(textField.hasText()) {
       			Ti.API.log("No bug!");
       		}
       	}
       	catch(e) {
       		Ti.API.warn(e.message);
       	}
       });
       
       // hide the keyboard when a user click out-side the field
       win.addEventListener('click', function() {
       	textField.blur();
       })
       
       containerView.add(textField);
       
       win.add(containerView);
       
       win.open();
       
    2. Select the text field and type a few characters. Expected Result: No crash. 'No Bug!' logs to console for every character typed.
  8. Shameer Jan 2013-11-07

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4863

JSON Source