Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No option to start with blank option for prefix and suffix in checkout. #7241

Closed
spyrule opened this issue Oct 31, 2016 · 9 comments
Closed
Labels
bug report Component: Customer Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@spyrule
Copy link

spyrule commented Oct 31, 2016

Fairly straight forward,

If you configure both/either Prefix and Suffix as Optional, and then populate the configuration list, there is no option to allow a blank option (if they choose not to select an option, it defaults to the first option in the list). Even if you precursor the list with a space and ";" it defaults to the first option after the first semi-colon.

Preconditions

  1. Magento 2.1.2 CE
  2. php 7

Steps to reproduce

  1. Go to Admin panel > Stores > Configuration > Customers > Customer Configuration
  2. Change "Show Prefix" and/or "Show Suffix" to "Optional"
  3. Populate "Prefix Dropdown Options" with : " ;Ms;Miss;Mrs;Mr;Dr;Atty;Hon;Prof;Pres;VP;MA"
  4. Populate "Suffix Dropdown Options" with : " ;Jr;Sr;Ph.D.;M.D.;R.N.;Ret."
  5. Click Save.
  6. Switch to the front-end, and add something to your cart.
  7. Go to the checkout page.
  8. You'll notice that Prefix and Suffix load with the lists, however it skips the starting "blank" option, and immediately selects "Ms" for Prefix, and "Jr" for Suffix.

Expected result

  1. If the admin selects Optional, the First options should ALWAYS be a blank (even if the admin doesn't configure a blank in the options). Id actually go as far as saying, the admin shouldn't NEED to configure a blank in the options if "Optional" is selected.

Actual result

  1. Instead of showing the first option if it is a blank, it selects the first actual option in the list, regardless of how you configure it (I understand, that its likely stripping blanks to prevent errors).

prefix-suffix-config1

prefix-suffix-noblankbydefault

@sevos1984
Copy link
Contributor

Thanks for reporting, internal ticket created MAGETWO-60288

@sevos1984 sevos1984 added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Oct 31, 2016
@sevos1984 sevos1984 removed their assignment Oct 31, 2016
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Customer Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added 2.2.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 5, 2017
@magento-engcom-team
Copy link
Contributor

@spyrule, thank you for your report.
We've created internal ticket(s) MAGETWO-60288 to track progress on the issue.

@avstudnitz
Copy link
Contributor

Working on this.

@avstudnitz
Copy link
Contributor

I solved parts of this in #11462. An empty line is added automatically if the field is set to "optional".
Unfortunately, I wasn't able to fix the default option selection in the checkout; it still always selects the first option with a value, it should select the first option at all.

I am pretty sure that the relevant code is in app/code/Magento/Ui/view/base/web/js/form/element/select.js (plus I modified app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js::optionNodeFromArray where I added the line option.setAttribute('data-title', ''); before line 222; this seems like a step in the right direction).

@avstudnitz
Copy link
Contributor

@benmarks has sent me a hint to a possible solution: https://stackoverflow.com/questions/15481380/knockout-js-setting-an-empty-selection. I added the optionsCaption parameter in

, but it gets lost somewhere in . To be honest, that method is a nightmare to debug and not exactly well readable so I still didn't get it running.

@okorshenko okorshenko assigned okorshenko and unassigned okorshenko Nov 1, 2017
dmanners added a commit to avstudnitz/magento2 that referenced this issue Dec 15, 2017
…fix in checkout.

 - replace usage of empty string for optional value with space so that the knockout.js picks up the optional values
@okorshenko
Copy link
Contributor

Hi @spyrule. Thank you for your report.
The issue has been fixed in #11462 by @avstudnitz in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Dec 22, 2017
magento-team pushed a commit that referenced this issue Dec 22, 2017
…x if optional #11462

 - Merge Pull Request #11462 from avstudnitz/magento2:7241
 - Merged commits:
   1. 11e38f6
   2. 7800e5d
   3. 252529f
   4. 519b805
   5. eb79b38
   6. fce3afe
   7. 3e38118
@magento-engcom-team
Copy link
Contributor

Hi @spyrule. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@csdougliss
Copy link
Contributor

csdougliss commented Mar 5, 2019

What version is this being added in?

I want to make prefix required field, but don't want an option selected by default. e..g show blank or "Select title"

@csdougliss
Copy link
Contributor

9c9ed91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Customer Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

7 participants