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

Wrong country "selected" if FormItCountryOptions snippet is used twice in same form #255

Open
gadgetto opened this issue Oct 24, 2021 · 2 comments

Comments

@gadgetto
Copy link

gadgetto commented Oct 24, 2021

Bug report

Summary

If the FormItCountryOptions snippet is used twice within the same form, the second snippet call selects the wrong country. It always selects the country from the first snippet call.

I tested the correct placeholder output with a hidden field. The placeholder data is correct - only the FormItCountryOptions snippet selects the wrong country.

This wasn't a problem in previous FormIt versions. I don't know which update introduced this bug.

Step to reproduce

...
<select class="form-control" name="country" id="country">
    <option value="" [[!+upd.country:is=``:then=`selected="selected"`]]>Land wählen</option>
    [[!FormItCountryOptions?
        &selected=`[[!+upd.country]]`
        &prioritized=`[[++country_priorisation]]`
        &limited=`[[++country_limitation]]`
        &country=`de`
   ]]
</select>
.....
...
..
<select class="form-control" name="country2" id="country2">
    <option value="" [[!+upd.country2:is=``:then=`selected="selected"`]]>Land wählen</option>
    [[!FormItCountryOptions?
        &selected=`[[!+upd.country2]]`
        &prioritized=`[[++country_priorisation]]`
        &limited=`[[++country_limitation]]`
        &country=`de`
   ]]
</select>
...

Environment

MODX 2.7.3-pl
FormIt 4.2.6-pl

@gadgetto
Copy link
Author

As this problem exists on a big webshop we built, I'd be very thankful if you could provide a quick hint on how to fix this!

@gadgetto
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant