diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee
index 41636071f..aca9cee32 100644
--- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee
+++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee
@@ -450,11 +450,11 @@ class App.ControllerForm extends App.Controller
# collect all params, push it to an array if already exists
if param[key.name] isnt undefined
if typeof param[key.name] is 'string'
- param[key.name] = [param[key.name], key.value]
+ param[key.name] = [param[key.name], key.value.trim()]
else
param[key.name].push key.value
else
- param[key.name] = key.value
+ param[key.name] = key.value.trim()
# data type conversion
for key of param
diff --git a/app/views/tests/form_trim.html.erb b/app/views/tests/form_trim.html.erb
new file mode 100644
index 000000000..e81d806f0
--- /dev/null
+++ b/app/views/tests/form_trim.html.erb
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/routes/test.rb b/config/routes/test.rb
index 6bbbfdde7..19ec957e3 100644
--- a/config/routes/test.rb
+++ b/config/routes/test.rb
@@ -5,6 +5,7 @@ Zammad::Application.routes.draw do
match '/tests-model', to: 'tests#model', via: :get
match '/tests-model-ui', to: 'tests#model_ui', via: :get
match '/tests-form', to: 'tests#form', via: :get
+ match '/tests-form-trim', to: 'tests#form_trim', via: :get
match '/tests-form-extended', to: 'tests#form_extended', via: :get
match '/tests-form-validation', to: 'tests#form_validation', via: :get
match '/tests-table', to: 'tests#table', via: :get
diff --git a/public/assets/tests/form-trim.js b/public/assets/tests/form-trim.js
new file mode 100644
index 000000000..9a8e73d76
--- /dev/null
+++ b/public/assets/tests/form-trim.js
@@ -0,0 +1,28 @@
+
+test( 'form trim checks', function() {
+
+ var el = $('#form1')
+ var test_params = {
+ input1: '',
+ input2: '',
+ input3: 'a',
+ input4: 'a b',
+ input5: 'äö ü',
+ textarea1: '',
+ textarea2: '',
+ textarea3: 'a',
+ textarea4: "test\r\n\r\n 123",
+ ce1: 'lala',
+ ce2: "la\nla",
+ }
+
+ el.find('[contenteditable]').ce({
+ mode: 'richtext'
+ })
+
+ var params = App.ControllerForm.params( el )
+
+ deepEqual( params, test_params, 'form param check' )
+ console.log('22', params)
+ console.log('22', test_params)
+})
diff --git a/test/browser/aab_unit_test.rb b/test/browser/aab_unit_test.rb
index 866f4818c..6b11065cd 100644
--- a/test/browser/aab_unit_test.rb
+++ b/test/browser/aab_unit_test.rb
@@ -45,6 +45,12 @@ class AAbUnitTest < TestCase
value: '0',
)
+ location( url: browser_url + '/tests-form-trim' )
+ match(
+ css: '.result .failed',
+ value: '0',
+ )
+
location( url: browser_url + '/tests-form-extended' )
sleep 8
match(