Is it possible to use the change event trigger of an item to get the name of the field?

hi All,

According to this image,

my method name is " change_field ".

The field names of text boxes framed by dashed lines on the screen are "A", "B", "C", and "D".
The text boxes that are framed with dashed lines have a text box below them that is not framed with dashed lines.
The field names are "A1", "B1", "C1", and "D1" respectively.

I want to get the field name of the current trigger method in the method "change_field", and change the value of other text boxes according to the field name.

Example: The user changes the text box with the field name "A" and triggers the method "change_field".
I need to get the field name of the current text box called "A" in the method "change_field" and read the field name of the current text box called "A" to change the value of the field name of the text box called "A1".

But I don't know how to write the syntax of 「get the field name of the current text box as "A"」

If somebody knows and can help I would really appreciate that.

Thank you.

  • Can anyone give me any idea?

  • How is your method currently implemented?

  • hi , silje.dahl

    Are you asking about my solution?

    I use the same on change method for the A, B, C, and D field events
    When the value of field A, B, C, D is changed, go to the field A1, B1, C1, D1
    Because my initial context setting is to backfill the A1 field after the value of A has been changed according to A
    So I use a loop to search for the fields on the screen in the on change event
    I found the A field and determined that it had a value before backfilling it to A1.

    I'm not good at English, so I'm using a translator for the above description.
    If you don't understand what I mean
    The code in the picture below is for your reference

  • Hello,

    I'm new to JS methods in ARAS myself, so please excuse me if I don't interpret the issue correctly.

    Does this have to be automatic? Could you not simply pass the name of the current field to the on_change function?

    I.e. have on_change take parameters such as ("propertyToUpdate", "otherPropertyToUpdate")

    Or if the A1 field doesn't have an attached property: ("propertyToUpdate", "otherHTMLFieldToUpdate")

    Then in the function, you could first update the main property:

    handleItemChange(propertyToUpdatedocument.getElementById(propertyToUpdate).value);

    Then depending on whether A1 is connected to its own Innovator item or if it's just an HTML field:

    handleItemChange(otherPropertyToUpdatedocument.getElementById(propertyToUpdate).value);
    or
    var otherField = document.getElementById(otherHTMLFieldToUpdate);
    otherField.value = document.getElementById(propertyToUpdate).value;
    I don't know how to update how the on_change method is attached to the field but you may have already solved that - otherwise maybe you could do something like this:
    var fieldA = getFieldByName(propertyName);
    var fieldAElement = fieldA.getElementsByTagName("input")[0];
    fieldAElement.onChange = `on_change("requ_beforedt", "otherPropertyOrFieldToUpdate")`
  • Unlike the input event, the change event is not necessarily fired for When the element is :checked (by clicking or using the keyboard) for  class="ice-cream" name="ice-cream"> <option value="">Select One Try entering something into the field below, and then click somewhere else to trigger the event.

    epayitonline