Commit 628eaa5f authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: auto focus on textarea

parent a48df1f1
......@@ -19,6 +19,7 @@
error_text: field_json.error_text,
title: field_json.description,
hidden: field_json.hidden,
focus: field_json.focus,
trim: true,
maxlength: field_json.maxlength,
// Force calling subfield render
......
......@@ -222,7 +222,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>988.26496.42040.8686</string> </value>
<value> <string>1008.49638.7192.9762</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1609253229.32</float>
<float>1701078143.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -18,6 +18,7 @@
title: field_json.description,
hidden: field_json.hidden,
required: field_json.required,
focus: field_json.focus,
// Force calling subfield render
// as user may have modified the input value
render_timestamp: new Date().getTime()
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>989.27523.29749.43383</string> </value>
<value> <string>1008.49638.7192.9762</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1614692613.61</float>
<float>1701077004.8</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -17,6 +17,7 @@
id: options.id,
name: options.name,
title: options.title,
focus: options.focus,
error_text: options.error_text || "",
hidden: options.hidden
});
......@@ -30,7 +31,8 @@
modification_dict.hasOwnProperty('required') ||
modification_dict.hasOwnProperty('id') ||
modification_dict.hasOwnProperty('name') ||
modification_dict.hasOwnProperty('title')
modification_dict.hasOwnProperty('title') ||
modification_dict.hasOwnProperty('focus')
) {
if (modification_dict.hasOwnProperty("value")) {
......@@ -52,6 +54,11 @@
textarea.required = false;
}
if (this.state.focus === true) {
textarea.autofocus = true;
textarea.focus();
}
if (this.state.editable) {
textarea.removeAttribute('readonly');
} else {
......@@ -78,7 +85,11 @@
}
})
.declareService(function focus() {
if (this.state.focus === true) {
this.element.querySelector('textarea').focus();
}
})
.declareMethod('getContent', function getContent() {
var result = {},
input;
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>990.28225.23941.23466</string> </value>
<value> <string>1012.50673.40518.63351</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1614695136.35</float>
<float>1701080787.95</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment