PageRenderTime 28ms CodeModel.GetById 22ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 1ms

/branches/jsdoc_tk_gui/setup/workingDirectory/Webeo/gui/form/TextField.js

http://jsdoc-toolkit.googlecode.com/
JavaScript | 32 lines | 14 code | 10 blank | 8 comment | 3 complexity | 1d5128ad4ad5e5d7ca13758e23bed6a8 MD5 | raw file
 1ek.register("gui.form.TextField");
 2
 3/**
 4 * Affiche un Champs text
 5 */
 6function TextField(domId){
 7	
 8	this.textDOM = document.getElementById(domId);
 9	this.textDOM.model = this;
10	this.textDOM.onkeyup = this.onKeyUp ;
11	
12	this.currentPattern = /([a-zA-Z]+)/;
13} 
14
15
16/**
17   onKeydown (en appuyant sur une touche)
18 onKeypress (en maintenant une touche appuyée)
19 onKeyup (en relâchant la touche)
20  */
21TextField.prototype.onKeyUp = function (e){
22	if (this.value.substring(this.value.length-1, this.value.length) == 1)
23		releaseEvents(Event.KEYUP);
24
25	while(this.value.length >0 && !this.value.match(this.model.currentPattern)){
26		this.value = this.value.substring(0, this.value.length-2);
27	}
28
29}
30
31
32