Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:57:45+00:00 2026-05-31T12:57:45+00:00

Why doesn’t TextField valueBind correctly when overriding the keyUp function? Example here http://jsfiddle.net/z5SNW/3/ .Basically

  • 0

Why doesn’t TextField valueBind correctly when overriding the keyUp function? Example here http://jsfiddle.net/z5SNW/3/ .Basically I am alerting the value of the TextField whenever enter is pressed or the user clicks the button. The problem is pressing the button doesn’t show the actual value until you focus out of the text field, and then click the button.

I can hack it by putting an else into the keyUp function and set the value there, but that doesn’t seem right to me. I think I am just missing something really simple.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:57:47+00:00Added an answer on May 31, 2026 at 12:57 pm

    By overriding keyUp the value of the TextField is only set when the change event is fired (on focus lost), see code.

    If you use the available insertNewline for your handling of enter, everything works: http://jsfiddle.net/z5SNW/6/.

    App = Ember.Application.create({});
    
    App.TextField = Em.TextField.extend({
        valueBinding: 'App.TextValue.value',
        insertNewline: function() {
            alert('Submitted: ' + App.TextValue.get('value'));
        }
    });
    
    App.TextValue = Em.Object.create({
        value: ''
    });
    
    App.SubmitButton = Em.Button.extend({
        click: function() {
            alert(App.TextValue.get('value'));
        }
    });​
    

    Or you keep your implementation of keyUp (if you plan to act on other keyCode’s as well, but then you have to call this.interpretKeyEvents(event);, see http://jsfiddle.net/z5SNW/8/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why doesn't this code work? I'am using FF. <head> <script type=text/javascript> document.getElementById(someID).onclick = function(){
Python doesn't support complicated anonymous functions. What's a good alternative? For example: class Calculation:
Why doesn't .NET regex treat \n as end of line character? Sample code: string[]
Why doesn't this jQuery code work? $(document).ready(function () { $('currentPage').click(function() { $('myaccount').slideDown('slow', function() {
Why doesn't JSON.parse behave as expected? In this example, the alert doesn't fire: <html
Why doesn't the first example output a warning? #!/usr/bin/env perl use warnings; use 5.012;
Doesn't work with other modules, but to give an example. I installed Text::CSV_XS with
Why doesn't the following code work? $('select option').live('click', function(){ alert('hello') }) html: <select class=ok>
Doesn't seem that failure mode for that function is documented anywhere I've been able
Why doesn't \w match Unicode word characters (for example, ğ,İ,ş,ç,ö,ü) in a Perl regular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.