Results 1 to 4 of 4
  1.    #1  
    Anyone knows how to pass the value of a text field to another within a scene as you actually type in the first textfield, meaning without having to submit with a button?
  2. roor's Avatar
    137 Posts
    Global Posts
    142 Global Posts
    I have been trying to figure this out myself.
  3.    #3  
  4. #4  
    you're going to want the on-property-change of the text box. then, the value of the textbox (the contents) that you initialized in the model is still in the model, but modified after you put text in
    so your event handler for on-property-change can get the information out of the model of the textbox and pass it to something else.

    so, something like
    this.commandInputTextAttributes = 
                visible: true,
                multiline: false,
                textReplacement: false,
                focus: false,
    			enterSubmits: true,
                requiresEnterKey: true,
                "changeOnKeyPress": true
            this.commandInputTextModel = 
                value: '',
                disabled: false
            this.controller.setupWidget('commandInput', this.commandInputTextAttributes, this.commandInputTextModel);        
            this.commandInputElement = this.controller.get('commandInput');
    in setup

    then in activate something like
    	this.controller.listen(this.commandInputElement, Mojo.Event.propertyChange, this.execute.bindAsEventListener(this));
    adn finally...

    CommanderAssistant.prototype.commandInputTextChanged = function(event){
        var commandValue = event.value;
        Mojo.Log.error("Commander::commandInputTextChanged - %s", commandValue);
        this.commandText = commandValue;
    CommanderAssistant.prototype.execute = function(event){
        if(Mojo.Char.isEnterKey(event.originalEvent.keyCode)) {
                Mojo.Log.error("Commander::Event Enter");
                Mojo.Log.error("Commander::Event Text is: %s", this.commandText);
                if(this.commandText) {
                    this.commandInputTextModel.disabled = true;
                    ////  now, here you write something to be DONE 
                    ////with this.commandtext and you're all finished.   
        } else {
            Mojo.Log.error("Commander::Event Text: %s", event.value);
            this.commandText = event.value;

Posting Permissions