Forum Discussion
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".
- christopher_gillis7 years agoNew Member
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.
- Former_Member7 years agoIdeator I
I'm using 11.0 SP12 version.
- christopher_gillis7 years agoNew Member
Hi Mille,
It looks like getFieldByName does exist in 11.0 SP12. Could you try explicitly calling this function with window.getFieldByName()? If that doesn't work you could also try getting the field by using standard HTML calls like below.
document.getElementsByName("item_number")[0].getElementsByTagName("input")[0];
Chris