Bug #14496
closedWSuggestionPopup selection lost on next request when cache-form-data is enabled
0%
Description
When a user selects an item from a WSuggestionPopup, the server permanently retains a stale (pre-selection) value for the associated edit widget in formDataCache_. Any subsequent HTTP request that does not re-send the field reads the stale value from the cache.
Minimal reproducible example¶
auto* edit = root()->addNew<Wt::WLineEdit>();
Wt::WSuggestionPopup::Options opts{ "<b>", "</b>", ',', " \n", "-., \"@\n;", "", "" };
auto* popup = root()->addNew<Wt::WSuggestionPopup>(opts);
popup->addSuggestion("apple");
popup->forEdit(edit);
auto* btn = root()->addNew<Wt::WPushButton>("Submit");
auto* result = root()->addNew<Wt::WText>();
btn->clicked().connect([edit, result] {
result->setText("Server received: " + edit->text().toUTF8());
});
- Type
a - Click
applein the popup - Click Submit
Expected: Server received: apple
Actual: Server received: a
Workaround: set <cache-form-data>false</cache-form-data> in wt_config.xml
Probable root cause¶
As I can see from the network console, when selecting the suggestion, WSuggestionPopup emits multiple events in a single request, of which the third one, prefixed with e2, contains the new value apple. On the server this is cached with the e2 prefix in formDataCache_ in WebSession. Possibly the value for the unprefixed key in formDataCache_ is not updated, causing subsequent requests to fall back to the old cached value.
Updated by Raf Pauwels 15 days ago
- Related to Feature #7986: Consider optimizing updates by only changing changed form values? added
Updated by Romain Mardulyn 15 days ago
- Related to Bug #14490: WPasswordEdit value is not updated with browser autocomplete added
Updated by Raf Pauwels 14 days ago
- Is duplicate of Bug #14490: WPasswordEdit value is not updated with browser autocomplete added
Updated by Romain Mardulyn 14 days ago
- Status changed from New to Implemented @Emweb
- Assignee set to Romain Mardulyn
Updated by Romain Mardulyn 14 days ago
- Related to deleted (Bug #14490: WPasswordEdit value is not updated with browser autocomplete)
Updated by Romain Mardulyn 7 days ago
- Status changed from Implemented @Emweb to InProgress
- Target version changed from 4.13.2 to 4.13.3
Updated by Romain Mardulyn 7 days ago
- Is duplicate of deleted (Bug #14490: WPasswordEdit value is not updated with browser autocomplete)
Updated by Matthias Van Ceulebroeck 7 days ago
- Status changed from Closed to InProgress
Updated by Romain Mardulyn 7 days ago
- Is duplicate of Bug #14490: WPasswordEdit value is not updated with browser autocomplete added
Updated by Romain Mardulyn 7 days ago
- Status changed from InProgress to Closed
- Target version deleted (
4.13.3)