Commit c48dae88 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Stringfield strips space characters

Mimic formulator behaviour to reduce jIO conflicts.
parent 4b946f64
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
required: field_json.required, required: field_json.required,
name: field_json.key, name: field_json.key,
title: field_json.title, title: field_json.title,
hidden: field_json.hidden hidden: field_json.hidden,
trim: true
}; };
state_dict.text_content = state_dict.value; state_dict.text_content = state_dict.value;
return this.changeState(state_dict); return this.changeState(state_dict);
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.22003.16805.3003</string> </value> <value> <string>955.51162.4768.35123</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1479375148.32</float> <float>1481623167.42</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
checked: undefined, checked: undefined,
title: '', title: '',
type: 'text', type: 'text',
required: false required: false,
trim: false
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
...@@ -24,7 +25,8 @@ ...@@ -24,7 +25,8 @@
title: options.title, title: options.title,
focus: options.focus, focus: options.focus,
step: options.step, step: options.step,
hidden: options.hidden hidden: options.hidden,
trim: options.trim || false
}; };
return this.changeState(state_dict); return this.changeState(state_dict);
}) })
...@@ -105,7 +107,11 @@ ...@@ -105,7 +107,11 @@
result[input.getAttribute('name')] = input.value; result[input.getAttribute('name')] = input.value;
} }
} else { } else {
result[input.getAttribute('name')] = input.value; if (this.state.trim) {
result[input.getAttribute('name')] = input.value.trim();
} else {
result[input.getAttribute('name')] = input.value;
}
} }
} }
return result; return result;
...@@ -122,6 +128,9 @@ ...@@ -122,6 +128,9 @@
} }
} else { } else {
result = input.value; result = input.value;
if (this.state.trim) {
result = result.trim();
}
} }
return result; return result;
}) })
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>955.22004.39620.55808</string> </value> <value> <string>955.51162.4768.35123</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1479376608.94</float> <float>1481623333.62</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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