PDA

View Full Version : [FIXED-197] NumberField is broken on iPhone



elishnevsky
3 Aug 2010, 1:15 PM
This is a good one. Introduced in v0.93. I can't reproduce this bug in neither Chrome nor Safari, but only on iPhone.
The Forms example at http://www.sencha.com/deploy/touch/examples/forms/ throws an error when rendering the NumberField in it and doesn't render anything that goes after it. I created a simple page and got the same error:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>NumberField</title>
<link rel="stylesheet" type="text/css" href="/touch/resources/css/ext-touch.css" />
<script type="text/javascript" src="/touch/ext-touch-debug.js"></script>
<script type="text/javascript">
Ext.setup({
onReady: function() {
var form = new Ext.form.FormPanel({
fullscreen: true,
items: [{
xtype: 'fieldset',
title: 'Number Field',
items: [{
xtype: 'numberfield'
}]
}]
});
}
});
</script>
</head>
<body>
</body>
</html>

The error is:

JavaScript Error on Line 13488 in ext-touch-debug.js
TypeError: Result of expression 'item' [null] is not an object.

Thanks.

Jamie Avins
3 Aug 2010, 3:36 PM
Thank you for the test case, we're taking a look into the problem.

hendricd
4 Aug 2010, 8:37 AM
There was a fix committed for NumberField right after the .93 build was made public.
Add this override to see if it covers your issue:



Ext.form.NumberField.override({

maskField : Ext.platform.isIPhoneOS,

renderTpl: [
'<div <tpl if="id">id="{id}" </tpl>class="{baseCls} {cls} {cmpCls}<tpl if="ui"> {uiBase}-{ui}</tpl> <tpl if="label">{labelAlign}</tpl>" <tpl if="style"> style="{style}"</tpl>>',
'<tpl if="label"><label <tpl if="fieldEl">for="{inputId}"</tpl>>{label}</label></tpl>',
'<tpl if="fieldEl"><input id="{inputId}" type="{type}" name="{name}" class="{fieldCls}"',
'<tpl if="tabIndex">tabIndex="{tabIndex}" </tpl>',
'<tpl if="placeholder">placeholder="{placeholder}" </tpl>',
'<tpl if="style">style="{style}" </tpl>',
'<tpl if="minValue != undefined">min="{minValue}" </tpl>',
'<tpl if="maxValue != undefined">max="{maxValue}" </tpl>',
'<tpl if="stepValue != undefined">step="{stepValue}" </tpl>',
'<tpl if="autoComplete">autocomplete="{autoComplete}" </tpl>',
'<tpl if="autoCapitalize">autocapitalize="{autoCapitalize}" </tpl>',
'/></tpl>',
'<tpl if="showClear"><div class="x-field-clear x-hidden-display"></div></tpl>',
'<tpl if="maskField"><div class="x-field-mask"></div></tpl>',
'</div>'
]
});

elishnevsky
4 Aug 2010, 8:47 AM
Yes, it fixes the issue. Thanks.

aaugustin
31 Mar 2012, 1:24 PM
I'm in Touch 2 and we changed one of our textfields to a numberfield to make it pull up the number keyboard and it broke it. We've tried commenting out pretty much everything else and that seems to be the problem, any thoughts?