Skip to content

Commit

Permalink
Make pickable hidden forms elements readonly
Browse files Browse the repository at this point in the history
Not visible element should be made readonly, since the user can't edit
them anyways.

This fixes a problem where Chrome would auto-fill hidden input and the
value would be saved without the user ever seeing it.

We already tried to fix the problem usign a standard solution
(auto-complete="off", symphonycms#1843 and symphonycms#1841) but it does not work. We also tried a non-standard
solution (symphonycms#2258) which was rejected.

This change only uses standard solution, even thought it relies on
javascript to make things works (it should not be a problem since the
backend now heavily relies on javascript)
  • Loading branch information
nitriques committed Jun 7, 2016
1 parent 8da82f6 commit 301d2b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions symphony/assets/js/src/symphony.pickable.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@

// Hide all choices
object.trigger('pickstart.pickable');
related.hide();
related.hide().find('input, select, textarea').prop('readonly', true);

// Selection found
picked = $('#' + choice);
if(picked.length > 0) {
picked.show().trigger('pick.pickable');
picked.show().find('input, select, textarea').prop('readonly', false).trigger('pick.pickable');
object.trigger('pickstop.pickable');
}

Expand Down

0 comments on commit 301d2b7

Please sign in to comment.