diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index 2770e283b..131e6779e 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -145,7 +145,7 @@ def submissions_params { metadata: {}, values: {}, readonly_fields: [], message: %i[subject body], fields: [:name, :uuid, :default_value, :value, :title, :description, :readonly, :redacted, :validation_pattern, :invalid_message, - { default_value: [], value: [] }] }]] + { default_value: [], value: [], preferences: {} }] }]] } ] diff --git a/app/controllers/api/submitters_controller.rb b/app/controllers/api/submitters_controller.rb index 99d9f3a81..442d16007 100644 --- a/app/controllers/api/submitters_controller.rb +++ b/app/controllers/api/submitters_controller.rb @@ -85,7 +85,7 @@ def submitter_params { metadata: {}, values: {}, readonly_fields: [], message: %i[subject body], fields: [[:name, :uuid, :default_value, :value, :readonly, :redacted, :validation_pattern, :invalid_message, - { default_value: [], value: [] }]] } + { default_value: [], value: [], preferences: {} }]] } ) end diff --git a/lib/submissions/create_from_submitters.rb b/lib/submissions/create_from_submitters.rb index 6635ba70e..89ee429de 100644 --- a/lib/submissions/create_from_submitters.rb +++ b/lib/submissions/create_from_submitters.rb @@ -130,6 +130,8 @@ def assign_field_attrs(field, attrs) end end + field['preferences'] = (field['preferences'] || {}).merge(attrs['preferences']) if attrs['preferences'].present? + return field if attrs['validation_pattern'].blank? field['validation'] = {