Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5513] MobileWeb: Javascript error when clicking the switch object

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-06T05:18:01.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsMobileWeb
Labelsn/a
ReporterMisha Vasko
AssigneeMaxim Negadaylov
Created2011-06-06T05:03:29.000+0000
Updated2017-03-09T20:41:06.000+0000

Description

in iPhone when clicking the Switch object the Javascript error occurs: Result of expression '_checkBox.touchstart' [undefined] is not a function.
var win = Titanium.UI.currentWindow;

//
// BASIC SWITCH
//
var basicSwitchLabel = Titanium.UI.createLabel({
	text:'Basic Switch value = false' ,
	color:'#999',
	font:{
		fontFamily: 'Helvetica Neue',
		fontSize: 15
	},
	textAlign:'center',
	top:10,
	height:'auto'
});

var basicSwitch = Titanium.UI.createSwitch({
	title: "Default title",
	value:false,
	top:30
});

basicSwitch.addEventListener('change',function(e){
	basicSwitchLabel.text = 'Basic Switch value = ' + e.value + ' act val ' + basicSwitch.value;
});

//
// CHANGE SWITCH
//
var changeButton = Titanium.UI.createButton({
	title:'Toggle Switch',
	height:40,
	width:200,
	top:90,
	fontSize:20
});
changeButton.addEventListener('click', function() {
	basicSwitch.value = !basicSwitch.value;
});

//
// HIDE/SHOW SWITCH
//
var hideShowButton = Titanium.UI.createButton({
	title:'Hide/Show Switch',
	height:40,
	width:200,
	top:140,
	fontSize:20
});

var hidden = false;
hideShowButton.addEventListener('click', function() {
	hidden ? basicSwitch.show() : basicSwitch.hide();
	hidden = !hidden;
});

//
// CHANGE title
//
var updateTitleButton = Titanium.UI.createButton({
	title:'Change title',
	height:40,
	width:200,
	top:190,
	fontSize:20
});

updateTitleButton.addEventListener('click', function() {
	basicSwitch.title = "Switch title " + Math.floor(Math.random() * 1000);
});


var closeButton = Ti.UI.createButton({
	title:'Close',
	height:40,
	top:240,
	width:200,
	fontSize:20
});

closeButton.addEventListener('click', function(){
	Ti.UI.currentWindow.close();
});

win.add(basicSwitchLabel);
win.add(basicSwitch);
win.add(changeButton);
win.add(hideShowButton);
win.add(updateTitleButton);
win.add(closeButton);

Comments

  1. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source