Value of picker from example on Android

You must Login before you can answer or comment on any questions.

The Forging Titanium Episode 10 located here

http://developer.appcelerator.com/blog/2011/10/forging-titanium-episode-10-forms.html/comment-page-1#comment-85110

Does not show how to get the picker value. If you look at the video at approximately 5:06 mark you will see on Android the value of State is undefined. I can't seem to get it to work. Can anyone please help me?

Thanks!

2 Answers

To get the picker value use the following code

myButton.addEventListener('click',function(event){
Titanium.API.info('Picker custom value is - ' + picker.getSelectedRow(0).custom_item);
Titanium.API.info('Picker title value is - ' + picker.getSelectedRow(0).title);
}
Hope this helps you

Insert the following code on line 104 in forms.js and it will work as I also faced the same issue which is resolved now.

fieldObject.addEventListener('change', function(e) {

        this.value = e.selectedValue[0];
    });

    fieldObject.getValue = function() {
        return this.value; };

    fieldObject.setValue = function(value) {
        fieldObject.value = value;
    };
— answered 12 months ago by Ratty A
answer permalink
1 Comment
  • Ratty A Great idea...

    If it shows undefined instead of the Value, add the code as suggested by Ratty A...

    fieldObject.addEventListener('change', function(e) {

        this.value = e.selectedValue[0];
    });
    
    fieldObject.getValue = function() {
        return this.value; };
    
    fieldObject.setValue = function(value) {
        fieldObject.value = value;
    

    };

    Thanks...

    — commented 11 months ago by Suresh Kumar S

Your Answer

Think you can help? Login to answer this question!