Skip to content

Commit

Permalink
Merge branch 'fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
plepe committed Jun 14, 2018
2 parents a137c50 + 02fb3cb commit 464a0cb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Newer
* Form Element Checkbox: support option 'auto_add_values'
* All elements which have 'values': new values_mode 'property'
* Form Element Array: new option 'createable'
* Form Element Text: option 'change_on' ('blur', 'keyup')

2017-09-15 (Version >= 2.6)
---------------------------
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ Definition:
* force_values: boolean; if true, value must be member of 'values' array (default: false).
* max_length: Value may not be longer than 'max_length' characters.
* max_bytes: Value may not be longer than 'max_bytes' bytes in the current encoding (hopefully UTF-8).
* change_on: per default, the element will emit the 'onchange' event on blur. if 'keyup', it will emit on the keyup event. (default: 'blur')

Value:
* String. Will be stripped of additional slashes.
Expand Down
2 changes: 2 additions & 0 deletions inc/form_element_form_chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ form_element_form_chooser.prototype.connect=function(dom_parent) {
var k = this.action_add.value
this.add_element(k)
this.notify_change()
this.action_add.value = ''
return false
}.bind(this)
}
Expand Down Expand Up @@ -342,6 +343,7 @@ form_element_form_chooser.prototype.show_element=function() {
var k = this.action_add.value
this.add_element(k)
this.notify_change()
this.action_add.value = ''
return false
}.bind(this)

Expand Down
12 changes: 10 additions & 2 deletions inc/form_element_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ form_element_text.prototype.connect=function(dom_parent) {
if(!this.dom_element)
this.dom_element=this.dom_parent.getElementsByTagName("input")[0];

this.dom_element.onblur=this.notify_change.bind(this);
if (this.def.change_on === 'keyup') {
this.dom_element.onkeyup = this.notify_change.bind(this)
} else {
this.dom_element.onblur = this.notify_change.bind(this)
}
}

form_element_text.prototype.create_element=function() {
Expand Down Expand Up @@ -41,7 +45,11 @@ form_element_text.prototype.show_element=function() {
input.value=this.data;
div.appendChild(input);
this.dom_element=input;
this.dom_element.onblur=this.notify_change.bind(this);
if (this.def.change_on === 'keyup') {
this.dom_element.onkeyup = this.notify_change.bind(this)
} else {
this.dom_element.onblur = this.notify_change.bind(this)
}

this.update_options();

Expand Down

0 comments on commit 464a0cb

Please sign in to comment.