3.2.0

onControlValidated issue - detecting 'keydown' event

Hi all!

I'm using the onControlValidated function on AW.UI.Input objects to detect user validation pressing 'Enter' key. The problem is that this function is also called when clicking outside of the input field!

This has already been described in this previous topic
http://www.activewidgets.com/javascript.forum.14055.4/onkeypress-for-enter-in-an.html (archived), but the trick does not work with firefox because window.event is not supported!

Does someone have an idea how we can resolved this issue for all browsers? Alex?

It is really a main issue for my application because my form is submitted twice most of the time!

Thank you in advance for your help
MF
November 23,
UP!

Alex, will this issue be corrected in 2.5 release?

If not, is it possible to patch OnControlValidated method to pass the event in parameter ? only the input text value is passed at this time.

Waiting for your reply...


MF
November 26,
I guess AW 2.5 should solve this, because onKeyEnter event is now processed on the main control object and not inside 'edit box' as in AW 2.0. This means that you can intercept onKeyEnter and cancel validation if necessary.
Alex (ActiveWidgets)
November 26,
Ok, thanks Alex. This would be great!
Is AW 2.5 still planned before the end of nov'07?

The application I'm working on, integrating AW, is scheduled for this date too!
MF
November 26,
I'm currently testing AW 2.5 rc1 and trying to intercept onKeyEnter event without success...
How can I do that?

Here's my code :
var obj = new AW.UI.Input;
document.write(obj);

obj.onControlValidated = function(text){
      var evt = this.getEvent("onKeyEnter");
      alert(evt);

       //my function
      userType(text);
}


'evt' variable is undefined, so I'm not able to test it before calling my function.

Am I missing something?
MF
November 26,
I was trying to say that the validation is triggered from inside onKeyEnter event and if you cancel that, then validation does not occur.

var obj = new AW.UI.Input;
document.write(obj);

obj.onKeyEnter = function(event){
    return true; // cancel 
}

obj.onControlValidated = function(text){
    window.status = "validated"; // does not fire on 'enter' key
}
Alex (ActiveWidgets)
November 26,
Ok, it make sense now.
In fact, I need the exact contrary : validation occurs when pressing "Enter" and not when clicking oustside the input.

How can I cancel the event "clicking outside the input"?!
If tried the following, but no result :
var obj = new AW.UI.Input;
document.write(obj); 

obj.onControlDeactivated = function(event){
     return true; // cancel  
}

obj.onControlDeactivating = function(event){
     return true; // cancel  
}

obj.onControlValidated = function(text){
    window.status = "validated"; // does not fire on 'enter' key
}


It seems that OnControlValidated is called before OnControlDeactivated, especially when clicking on the parent grid rows (input object is placed in the 2nd header of a grid to enter filter)...
MF
November 29,

This topic is archived.

See also:


Back to support forum