gluon-web-model: update inputs on form reset
Register to 'reset' event on form element and make call to 'update' function delayed in 'data-update' handler to allow the form values to update beforehand. When using a form's 'reset' button, form field visibility was not updated. This could lead to situations where a checkbox had to be toggled again twice to display the detail text inputs. (Example taken from private wifi package) (cherry picked from commitbf090a8a83) (cherry picked from commit02e213a718)
This commit is contained in:
parent
70990f6732
commit
45ac73a597
@ -1,4 +1,4 @@
|
|||||||
<form method="post" enctype="multipart/form-data" action="<%|url(request)%>">
|
<form method="post" enctype="multipart/form-data" action="<%|url(request)%>" data-update="reset">
|
||||||
<input type="hidden" name="token" value="<%=token%>" />
|
<input type="hidden" name="token" value="<%=token%>" />
|
||||||
<input type="hidden" name="<%=id%>" value="1" />
|
<input type="hidden" name="<%=id%>" value="1" />
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -517,7 +517,7 @@
|
|||||||
for (var i = 0, node; (node = nodes[i]) !== undefined; i++) {
|
for (var i = 0, node; (node = nodes[i]) !== undefined; i++) {
|
||||||
var events = node.getAttribute('data-update').split(' ');
|
var events = node.getAttribute('data-update').split(' ');
|
||||||
for (var j = 0, event; (event = events[j]) !== undefined; j++) {
|
for (var j = 0, event; (event = events[j]) !== undefined; j++) {
|
||||||
bind(node, event, update);
|
bind(node, event, function () {setTimeout(update, 0);});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user