changeset 0690b9561ef9 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=0690b9561ef9
description:
Remove type attribute on invisible URL widget
The widget may be filled with invalid content when it is invisible.
issue10473
review336611003
diffstat:
src/view/form.js | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (41 lines):
diff -r 628ae4d92da0 -r 0690b9561ef9 src/view/form.js
--- a/src/view/form.js Mon Jul 12 23:01:27 2021 +0200
+++ b/src/view/form.js Wed Jul 21 23:59:00 2021 +0200
@@ -4251,9 +4251,10 @@
Sao.View.Form.URL = Sao.class_(Sao.View.Form.Char, {
class_: 'form-url',
+ _type: 'url',
init: function(view, attributes) {
Sao.View.Form.URL._super.init.call(this, view, attributes);
- this.input.attr('type', 'url');
+ this.input.attr('type', this._type);
this.button = this.labelled = jQuery('<a/>', {
'class': 'btn btn-default',
'target': '_blank',
@@ -4304,15 +4305,20 @@
this.button.removeClass('btn-link');
this.button.addClass('btn-default');
}
- }
+ },
+ set_invisible: function(invisible) {
+ Sao.View.Form.URL._super.set_invisible.call(this, invisible);
+ if (invisible) {
+ this.input.attr('type', '');
+ } else {
+ this.input.attr('type', this._type);
+ }
+ },
});
Sao.View.Form.Email = Sao.class_(Sao.View.Form.URL, {
class_: 'form-email',
- init: function(view, attributes) {
- Sao.View.Form.Email._super.init.call(this, view, attributes);
- this.input.attr('type', 'email');
- },
+ _type: 'email',
set_url: function(value) {
Sao.View.Form.Email._super.set_url.call(this, 'mailto:' + value);
}