Cancel Button For Text Area
I need to know how to get the cancel button to cancel what the user types into the text area. The text area will already have some text in it which is pulled from a database. However, the user will have the option to edit the text and save it to the server. I'm not the back-end guy, so I'm not really concerned with those details. I just need to know how to cancel the text the user just added.
Thanks!
3 Answers
-
var search = Titanium.UI.createSearchBar({
barColor:'#000',
showCancel:true,
height:43,
top:0,
hintText:'search'
});
Titanium.UI.currentWindow.add(search);search.addEventListener('cancel', function(e)
{
Titanium.API.info('search bar cancel fired');
search.blur();
search.value="";
});same as for createTextField
-
Add a keyboardToolbar with the button you'd like, then add something like:
close_button.addEventListener('click', function(e) { textarea.blur(); });
-
Thanks for the comments guys. I ended up using:
var paText = "Sample Text"; cancel.addEventListener('click',function() { paAnnouncement.blur(); paAnnouncement.value=paText; });
That worked!
I wasn't declaring the value in the text area as a variable, just as a hard coded value.