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

erp5_web_renderjs_ui: support maxlength in StringField and EmailField.

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