Skip to content

Instantly share code, notes, and snippets.

@Laszlo-JFLMTCO
Last active September 26, 2017 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Laszlo-JFLMTCO/07bdad9e445b09bd74d8ef08cdcb4982 to your computer and use it in GitHub Desktop.
Save Laszlo-JFLMTCO/07bdad9e445b09bd74d8ef08cdcb4982 to your computer and use it in GitHub Desktop.
Gravity Form losing dropdown selection after unsuccessful form submission

Ticket reference:

Please note that a standard support ticket was submitted first by mistake. Number of that ticket is: #198273

Failure mode:

After submitting incomplete form (not all required fields are completed), after updating the form with error messages, the dropdown box does NOT preserve its previous selection.

Precondition:

  • Form is running in AJAX mode

Steps to reproduce the issue

  1. Go to page http://boulderjuniorcycling.org/bike-a-thon/
  2. Scroll down to the "Donation Amount" dropdown box (see that the default value is $50.00)
  3. Scroll down further and click on the "Donate Now" button => this will trigger submitting the incomplete form
  4. Wait until form is updated with error messages (highlighting missing information)
  5. Scroll down to the "Donation Amount" dropdown box
  6. See that the dropdown has now $500.00 selected instead of $50.00

Top level cause of the issue:

Screenshot showing dropdown HTML code after step 1 of the repro sequence

Please note that properly only the $50.00 option is selected
form_dropdown_correct

Screenshot showing dropdown HTML code after step 6 of the repro sequence

Please note that INCORRECTLY all options are rendered with selected. Since $500.00 is the last option in the list with selected, that is the one that is the current amount that is updating the total of the form. form_dropdown_incorrect

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