AutoFill not working (v2020)

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Niijimasama
User
Posts: 85

AutoFill not working (v2020)

Post by Niijimasama »

Hi All,

Need some help.

I am a big fan of the autofill feauture in PHPMaker. I migrated my project from v2019 to v2020 and now it seems that all columns set to autofill are not working.

The feature still works on the my v2019 project. I have checked the notes on how to setup autofill on both versions of the helpfile and they are pretty much the same.

What could have changed?


arbei
User
Posts: 9401

Post by arbei »

Mine are working. Nothing was changed. You may post your settings so other users can try to reproduce.

You may also press F12, go to the Network panel and check the HTTP response from the API.


Niijimasama
User
Posts: 85

Post by Niijimasama »

The error I am getting is:

Uncaught TypeError: Cannot read property 'push' of undefined


When I go to line 722, I find the value is set to on change equating to ew.Autofill

I have not changed my settings from the v2019 project, and the help file on setting up autofill is the same on both versions.
What am I missing?


arbei
User
Posts: 9401

Post by arbei »

Niijimasama wrote:
Uncaught TypeError: Cannot read property 'push' of undefined


When I go to line 722, I find the value is set to on change equating to ew.Autofill

  • If v2019+, it should be "ew.autofill", not "ew.Autofill". Did you use some old code? (e.g. server event and client scripts, old extension, third-party extension, etc.)
  • According to the error message, the code must contains "xxx.push". The "xxx" is null or undefined so you got the error. You may try to find the correct line and post it.

Niijimasama
User
Posts: 85

Post by Niijimasama »

No old extensions or third party extensions being used. In the whole project,
Only Client script is for Google Maps and Sweetalerts.

The autofill is implemented by following the guide on the help file. No user code on the field or table.


arbei
User
Posts: 9401

Post by arbei »

Niijimasama wrote:
The error I am getting is:

Uncaught TypeError: Cannot read property 'push' of undefined


When I go to line 722, I find the value is set to on change equating to ew.Autofill

You may copy and post code around the error line to here for discussion. (If you are registered user, you better send your info to support: https://phpmaker.dev/support.php.)


mobhar
User
Posts: 11741

Post by mobhar »

Niijimasama wrote:
Only Client script is for Google Maps and Sweetalerts.

Post those related code also for more discussion. Perhaps it will cause the issue for the Autofill feature.


Niijimasama
User
Posts: 85

Post by Niijimasama »

Hi.

After some comparison and remaking the project without any user code whatsoever(PHP or JQUERY) and with the code, I think I have identified the cause of the problem.

***For clarification, the product code & product rate(the target for auto-fill) fields are both in the detail table.

BACKGROUND

My application is designed to be multi-user & multi-entity and each entity has its own products. Because of this, filtering the products by entity is a necessity.

The Auto-fill would fail when I add PARENT FILTER on the product code on lookup table setup.

I replicated this problem across all of my Master-Detail tables(4) where Auto-fill is enabled.

MY SOLUTION

  1. Removed the parent filter.
  2. Went to the filter field and added the code: "shop_id = ".CurrentUserInfo("user_shop")."" and it now works.

MY HYPOTHESIS
For whatever reason, the push function is receiving a null object after selecting a product i.e though the array is initialized, there are no index keys in the object representation of the array. You get UNDEFINED when you try to access the array value at index 0, but it’s not that the value undefined is stored at index 0, it’s that the default behavior in JavaScript is to return undefined if you try to access the value of an object for a key that does not exist.
Is this caused by Asynchronous loading? I am no guru in Javascript so I don't know.


Post Reply