Search code examples
titaniumappceleratorappcelerator-mobile

Appcelerator. Using factories but cannot access textfield values


I am developing an iOS app using appcelerator and I am trying to use JavaScript factories to seperate design (UI) from functions.

I made a component that shows a textfield in a fancy way (code located in ui.js). You can view the code here: http://pastie.org/2188537.

I then call the component like this on another page.

var desc = ambadooUI.createTextField({

    hinttext: 'Label (Personal/Work/Gmail...)',
    vertical: 10,
    container: 'top'

});

The problem is now that I cannot access the data/value of the textfield. How can I do it? Am I forced to use custom events?

Thankful for all input!


Solution

  • just add the textField object as a property of the object you are returning.

    for example at line 44, ui.js, you can do something like

    // Return the finished button
    top.text_field = textfield;
    return top;