This topic is locked
[SOLVED]

Field events - Cannot read properties of undefined (reading 'setValue')

7/5/2022 12:57:41 PM
ASPRunner.NET General questions
S
sevy1971 authorDevClub member

Hi,

I've a strange problem in the field events. To find a solution I created a small projet in ASPRunner.net 10.7 (Build 39273 x64).

First I created a new handler "StringResultatVisite_Event" for the change event.

  1. Client before (nothing)
  2. Server (nothing)
  3. Client after

var ctlTest = ctrl.getPeer('txtNoVisit');
ctlTest.setValue( 100 );

(the control (field) txtNoVisit exist in the list with "Spreadsheet mode" activated

Unfortunately all my tests result in an error
Uncaught TypeError: Cannot read properties of undefined (reading 'setValue')

Thanks for any help!
YVes

Sergey Kornilov admin 7/5/2022

It looks like it should work but it is hard to tell without having access to your project.

Did you test it on a regular Add or Edit page?

S
sevy1971 authorDevClub member 7/5/2022

Hi,

Unfortunately the same problem on regular Add or Edit page!

Yves

Sergey Kornilov admin 7/5/2022

Definitely works in the test project. You might be doing something wrong or different. The error message itself suggests that field 'txtNoVisit' doesn't exist on that page or is not spelled correctly.

S
sevy1971 authorDevClub member 7/6/2022

Hi

By "The error message itself suggests that field 'txtNoVisit' doesn't exist on that page or is not spelled correctly." do you mean the "database field name" or the "id name"?

Yves

Update: ahhhhhh it's the database field name! :-)

Sergey Kornilov admin 7/6/2022

There is no such thing as "id name". ID is ID, and name is a name. Javascript Control API works with database field names.