Topic: Dropdown Menu Behavior After Ajax Fail

Hello Everyone

When select onchange ajax request fail on dropdown menu in customer/supplier/inventory. When we get see warning triangle, the selected customer/supplier/inventory is different from populated input field. To get the correct data we have to change customer/supplier/inventory to other value then back to previous value.

Here is screenshot example
https://mpulse.in/images/FA_feature_suggestion.jpg

In the above example while selecting customer Keshav Enterprise my ajax request failed. The input field below are populated with previous selected user which is K.K. Enterprises. Now to get details of Keshav Enterprises We have to select some other customer then again Keshav Enterprises.

It would be appreciated, if reload button with onclick ajax function to populate the input field could be added beside warning triangle .

Thanks and Regards

Post's attachments

FA_feature_suggestion.jpg 139.4 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.
Mohsin Mujawar
Impulse Solutions

Re: Dropdown Menu Behavior After Ajax Fail

See, https://frontaccounting.com/punbb/viewtopic.php?id=8672.

Re: Dropdown Menu Behavior After Ajax Fail

Thanks for your reply Braath Waate

I have read the thread your mentioned above

to retry is good option but if retry fail as per code

                if(retry)
                    JsHttpRequest._request(trigger, form, tout, retry-1);
                else location.reload(true);

this will refresh page as this failing process will be happening in background, to see page refreshing without knowing error will make user worried about what is happening. Further it will clear all fields including selected customer/supplier/inventory option.

Warning Indicator is seen only when there is ajax error so user is aware something is wrong. Further I have noticed for example there are

OPTION A
OPTION B
OPTION C

user first selected OPTION A ajax call is made and failed mean while user has already selected OPTION C during ajax process. Now user want details of OPTION C not OPTION A

Reload button after ajax fail will eliminate this issue. Now when user will click reload only details of selected option will be populated into input fields.

Regards

Mohsin Mujawar
Impulse Solutions

Re: Dropdown Menu Behavior After Ajax Fail

The issue with your reload option is if it is NOT pressed.  That is, if the list is left with option C as the user selected, the rest of the page is now inconsistent because the page was not loaded with the option C data.

I do not have any more to say about this problem other than to recommend detkenn's solution which minimizes the data loss to the user when ajax fails to load the page properly.

Good luck.

Re: Dropdown Menu Behavior After Ajax Fail

You are correct, anyways thanks for your help. Let me see if I can work this out.

Mohsin Mujawar
Impulse Solutions

6 (edited by dearmosin 08/14/2020 04:46:44 am)

Re: Dropdown Menu Behavior After Ajax Fail

In inserts.js I found this line 142

            if ((this.selectedIndex != this.getAttribute('_last'))
                ||((string_contains(this.className, 'combo') || string_contains(this.className, 'combo3')) && _update_box(this))
                )

should it be

            if ((this.selectedIndex != this.getAttribute('_last'))
                && ((string_contains(this.className, 'combo') || string_contains(this.className, 'combo3')) && _update_box(this))
                )

Also

e.setAttribute('_last', e.selectedIndex);

must be set after JsHttpRequest.request(update) request is completed

Mohsin Mujawar
Impulse Solutions

Re: Dropdown Menu Behavior After Ajax Fail

@joe: is this the solution?

Past references are in Posts 7 and 10 of:
https://frontaccounting.com/punbb/viewtopic.php?id=8672

Re: Dropdown Menu Behavior After Ajax Fail

Mantis Bug Tracking For This Issue - http://mantis.frontaccounting.com/view.php?id=5201

Mohsin Mujawar
Impulse Solutions

Re: Dropdown Menu Behavior After Ajax Fail

Since _last is set with e.selectedIndex before making ajax request. If ajax fails input value are not populated with data. but selected drop down option is e.selectedIndex. This can result in data loss or data overwrite on records.

Mohsin Mujawar
Impulse Solutions