On my titanium app i have a form with many fields (textfield etc...), when i focus on textfield it shows the ios keyboard and i want to hide it when i click somewhere on the window :
<Alloy>
<Window id="home" >
<View id="form">
<Require type="view" id="myViewForm" src="form/etape_1" />
</View>
</Window>
</Alloy>
inside myViewForm :
<Alloy>
<View>
<TextField id="name" hintText="name"/>
<TextField id="telephone" hintText="Téléphone"/>
</View>
</Alloy>
Note : As you see i have a textfield with id "telephone" that will show only numbers.
on my controller home file :
/*-----------------------------------------
| | EVENT LISTENER CLICK ON WINDOW
-------------------------------------------*/
$.home.addEventListener("click", hideSoftKeyboard);
/*-----------------------------------------
| | HIDE KEYBOARD
-------------------------------------------*/
function hideSoftKeyboard(e){
if(Ti.Platform.osname === 'android'){
Ti.UI.Android.hideSoftKeyboard();
} else {
$.home.textField.blur();
}
}
On android it works well, but on Ios i have following error :
[ERROR] : Script Error {
[ERROR] : column = 103;
[ERROR] : line = 12;
[ERROR] : message = "undefined is not an object (evaluating '$.home.textField.blur')";
[ERROR] : stack = hideSoftKeyboard;
[ERROR] : }
Someone could help me please ? thank you.