How to pass Form fields value to Method

I'm new in Aras Innovator and I need some help with Forms.
I have created a simple form with first name and last name and with a Submit button.
The button's click event will call a method where I want to use the first and the last name field values.


How can I pass the value from form to method and how can I use it there?

And also where can I complete the form to try it?

Parents
  • Hi Millie,

    There's a couple different ways to get the value of a field. The window of the form holds a copy of the item that gets updated as users fill in data in the fields of the form. Because of this you can get the value of the fields directly from this copy of the item like so. You'd just need to updated the bolded text to match the name of the property you're looking for.

    document.thisItem.getProperty("item_number");

    Alternatively, you can get the value directly from the HTML element of the field. This is helpful if the form that you're using isn't linked to an item like one opened from a dialog. To get the value of the field directly, you can use the sample code below.

    getFieldByName("item_number").getElementsByTagName("input")[0].value

    Similarly, you'd just need to update the bolded text to match the name of the field you're looking for.

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

  • Thank you!
    It tells me that "The name 'getFieldByName' does not exist in the current context".

  • Could you let us know what version of Aras Innovator you're using? I ran my test in an 11.0 SP15 instance, and some of these function names can change between service packs.

Reply Children