Commit 3454c143 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_web_renderjs_ui: support maxlength in StringField and EmailField.

parent e9f059a9
...@@ -551,6 +551,10 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, ...@@ -551,6 +551,10 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None,
if meta_type in ("StringField", "FloatField", "EmailField", "TextAreaField", if meta_type in ("StringField", "FloatField", "EmailField", "TextAreaField",
"LinesField", "ImageField", "FileField", "IntegerField", "LinesField", "ImageField", "FileField", "IntegerField",
"PasswordField", "EditorField", "HyperLinkField", "LinkField"): "PasswordField", "EditorField", "HyperLinkField", "LinkField"):
if meta_type in ("StringField", "EmailField"):
result.update({
"maxlength": field.get_value("display_maxwidth"),
})
if meta_type == "FloatField": if meta_type == "FloatField":
result.update({ result.update({
"precision": field.get_value("precision"), "precision": field.get_value("precision"),
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
error_text: field_json.error_text, error_text: field_json.error_text,
type: 'email', type: 'email',
hidden: field_json.hidden, hidden: field_json.hidden,
maxlength: field_json.maxlength,
// Force calling subfield render // Force calling subfield render
// as user may have modified the input value // as user may have modified the input value
render_timestamp: new Date().getTime() render_timestamp: new Date().getTime()
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
title: field_json.description, title: field_json.description,
hidden: field_json.hidden, hidden: field_json.hidden,
trim: true, trim: true,
maxlength: field_json.maxlength,
// Force calling subfield render // Force calling subfield render
// as user may have modified the input value // as user may have modified the input value
render_timestamp: new Date().getTime() render_timestamp: new Date().getTime()
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
step: options.step, step: options.step,
hidden: options.hidden, hidden: options.hidden,
trim: options.trim || false, trim: options.trim || false,
maxlength: options.maxlength,
multiple: options.multiple, multiple: options.multiple,
accept: options.accept, accept: options.accept,
capture: options.capture, capture: options.capture,
...@@ -89,6 +90,9 @@ ...@@ -89,6 +90,9 @@
if (this.state.accept) { if (this.state.accept) {
textarea.setAttribute('accept', this.state.accept); textarea.setAttribute('accept', this.state.accept);
} }
if (this.state.maxlength) {
textarea.setAttribute('maxlength', this.state.maxlength);
}
if (this.state.multiple) { if (this.state.multiple) {
textarea.multiple = true; textarea.multiple = true;
......
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