Skip to content

Amount of characters on a 'Area' Customizable Option counted differently on backend/frontend #25974

Closed
@hans-vereyken

Description

@hans-vereyken

Preconditions (*)

  1. Vagrant box, Debian 9
  2. Magento 2.2.9
  3. Chrome 78
  4. Create a virtual product with Customizable Options:
  • Option Title: Message
  • Option Type: Area
  • Max Characters: 20
  • Don't forget to add a price and stock

Steps to reproduce (*)

  1. Try to put this product in your basket with a message 'Is twenty characters' => OK on front and can add to cart.
  2. Try to put this product in your basket with a message with a newline:
    'Is
    twenty
    characters'
    => Ok on front, but error on adding to cart: 'The text is too long.'

Expected result (*)

  1. If the Javascript validator validates the input, it should be valid on server-side as well.

Actual result (*)

  1. Error shown although the Javascript validator passed.

Summary

The Javascript validator counts newlines as a single character (\n).
On the server side (\Magento\Catalog\Model\Product\Option\Type\maxCharacters) newlines are counted as 2 characters (\r\n).

Metadata

Metadata

Assignees

Labels

Area: FrontendComponent: MessageFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions