Last filled in field is empty when saving entity from form (IE8).

4
After migrating from 2.5.7.1 to 3.3.2 we are now faced with an issue that is quite mind boggling. We have a form with a dataview of an order. From there users must select (from another form) an address as a destination. So far so good. Instead of selecting an address users are able to create a new address. That's where the trouble starts. After filling in the required fields for creating a new address and hitting the 'save' button the last field that was filled in by the user will be empty by the time it enters Mendix. This happens only when the user directly clicks on 'save' after filling in the last field. When the user clicks on the 'new address form' first before clicking on 'save' everything goes as expected. In other words, it appears that the field which has focus doesn't make it into the request. The problem only occurs with IE 8. When using IE7, IE9 or Firefox the form behaves as expected. Anyone else having this problem - or preferable - a solution? Update 2012-07-23 15:46 It seems that the issue only occurs with the combination XP + IE8 and only in certain cases.
asked
4 answers
4

Thanks to Daniel Schilperoord (Mendix) we have a temporary solution. We've added following code in our theming, right below the include of mendix.js / mxui.js:

<script type="text/javascript">
            (function() {
                var proto = mxui.widget.ViewButton.prototype,
                    ref   = proto._mouseDown;

                proto._mouseDown = function() {
                    this.domNode.focus();
                    ref.call(this);
                };
            })();
        </script>

By adding this code the focus will be set on the button at the moment that you click on the button. Seems like IE8 doesn't always recognize a change in a input field and therefore not send it to the server. By losing the focus in the input field, we force the client to send all changes in the form to the Mendix server.

We will update our ticket in the support portal with a testproject so that Mendix can fix this in the mendix framwork.

answered
1

We've had a similar problem, where users would enter data in a form and although the data had been entered, a microflow which checked the data considered these fields empty. This problem only occured in IE8.

Mendix fixed this problem for us, by changing the theme of the application. I don't know what they've fixed and HTML and/or Javascript is not my specialty, so I don't have the final answer for you, but I'd suggest you contact Mendix.

answered
1

This is indeed a bug, which has already been reported by Samet Kaya. The bug was caused by Internet Explorer 8 not moving the focus to the button once clicked. A change to an input field is only handled once it loses the focus. If it does not lose the focus the change will not be sent to the runtime before executing the save action.

This bug will be fixed in the next maintenance release. In the meanwhile the workaround suggested by Samet can safely be used. The snippet suggested by Rom van Arendonk fixed another problem with Internet Explorer, where an input field didn't get the focus at all while it was still possible to enter text. Although the result was the same (values were not saved) this has already been fixed in version 3.3.0 (so it should be removed to avoid unexpected behavior).

answered
0

I've checked the theme for my project, and found .js file which was used. This is the code:

removed to avoid confusion: this bug has been fixed in 3.3.0, see comments.

answered