Wrong controls initialed on page refresh
https://gist.github.com/773373
Non relevant fields are initialized on page refresh.
Steps to reproduce
- Access the page. Notice the two alerts. "init - uncheck" and "enabled - uncheck".
- Select the check box. Check control is initialized. Two alerts again. This control was not relevant previously.
- Refresh the page (I am using firefox). Notice the non-relevant control is initialized but the relevant control is not. You can tell from 开发者_Go百科the alerts.
Interestingly the right component is shown but xforms-enabled is called on the wrong component.
Getting those 2 alerts for the non-relevant control on page refresh is normal. However, after those, you should also get alerts for the newly relevant control. I created a bug for this, and will update this response when the issue is fixed.
When you do a reload (ctrl-r) on Firefox, the HTML is in its initial state, as it was the first time the page was loaded. However, since Firefox resets the form fields to their value before the reload, we can detect with JavaScript that a reload happened, and the browser can ask the server "please tell me everything I need to do on the initial HTML to put it back to state X". The server resends all the events it sent when you clicked on the checkbox, except the <xxf:script>
, which is responsible for your script running, hence the behavior you observe.
We did some brainstorming on this issue, and described a solution, which at this point still need to implement.
精彩评论