Skip to content

When checkout domain contact form dropdown options change, their values are not updated #73190

Open

Description

To reproduce:

  • Add a domain product to your cart and visit checkout.
  • Fill in the contact information form with a valid US address. For this example, we'll assume the "State" field is "New York".
  • Click Continue to validate the fields and move on to the next step.
  • Click "Edit" to return to the contact step.
  • Change the "Country" field to another country with a "State"/"Province" field (they are the same field with different names depending on the country). For this example, we'll assume it's "Canada".
  • Changing the country will replace the options in the "State"/"Province" field, so now the selected value will be "Alberta" (the first value).
  • Do not change the Province but set the other fields to valid CA values.
  • Click Continue to validate the fields.

Expected: the fields will be validated successfully.

Actual: the fields fail with an error displayed for the country dropdown saying it has an invalid value.

This would not be an issue if the "State"/"Province" field was an input and not a dropdown. Then you'd see that changing the country does not change the values of the other fields. However, because it's a dropdown, the field's value is still "New York"; since that doesn't match any of the options in the dropdown, it reads "Alberta" (the first option), but that's not the value that will be sent to the validation endpoint (or the shopping-cart endpoint, etc.).

This may also affect other fields which use dropdowns.

One possible solution could be to change dropdowns in the form to show an invalid option (like --- or Select Province) if no options are selected.

Screenshots

Screenshot 2023-02-09 at 4 07 58 PM

The validation request payload: (notice that state is wrong):
Screenshot 2023-02-09 at 4 08 47 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions