Forum Discussion

team_aras_meupe_com's avatar
3 years ago
Solved

Pass values from Method to form fields

Hello, I would like to pass a value to a field of an itemtype by code. I have put it in the "onBlur" event of another field
The case is that I pass the value and it shows it on the screen, but when I click on save (lock), it deletes the data.

What am I doing wrong?

My code:

var input = getFieldByName("mp_dni");
input.getElementsByTagName("input")[0].value = "AAAAAAAAAA";

After passing the value to it:

 

when i lock:

 

 

Too many thanks!!!.

 

  • You code just change the visible value in the form, but doesn´t update the property in the DOM.

    Try to use something like this: window.handleItemChange("myproperty", "123");

5 Replies

  • You code just change the visible value in the form, but doesn´t update the property in the DOM.

    Try to use something like this: window.handleItemChange("myproperty", "123");

    • team_aras_meupe_com's avatar
      team_aras_meupe_com
      Creator III

      Thank you very much Angela for your help, you are always there to help!!

      The truth is that I am a bit overwhelmed with ARAS and Javascript, every little step is a leap into the void.
      I'm thinking of taking a Javascript course, because I'm afraid that many of the things that are hard for me to do are basic things, and I should know them.

      Now, Google and this forum are my best "friends", hahaha.

      Thank you so much!!!

      • angela's avatar
        angela
        Catalyst II

        Don´t worry, PLM will always be hard, but the level you rate as "hard" will change. 

        I needed 3 months to understand how relationships work und 3 years to feel comfortable enough with very basic coding (first action with copied Method...). 

        If you have a subscription, check out the developers guide. "window.handleItemChange" is not classic JS, but a Aras specific function. The developers and programmers guide cover most of the basics you need for Aras specific coding.

        Best regards

        Angela

        P.S.: Do you want to know MY new best friend regarding generic JavaScript questions? -> ChatGDP !
        It´s sucks regarding specific Aras Innovator questions, but is a game change for literally everything else!