Category: Question and Answers
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to use JSON Form array currentItem

Issue

I'm having trouble accessing the current item or index of an array in a JSON form. Each element in the array has an id and a name attribute, and I want to display the corresponding name in a separate input box when the user selects an option. However, I don't know how to request the API and display the response for the currently selected element in the array. I have tried declaring a currentItem variable, but it shows as undefined. Appsmith support has informed me that there is currently no solution for this issue, but I am looking for alternative ways to solve my problem.

Resolution

Based on the conversation, it seems that the user wants to display the name of the selected option in the corresponding name input box after making an API request using the selected option id. However, since this is an array and the user is not sure which element is currently being manipulated, they are unable to retrieve the correct information for the selected option.

Unfortunately, Appsmith does not currently have a way to access the current item or index of arrays in a JSON Form. The user can track the issue previously found and leave a comment with their use case to help prioritize the issue for updates.

At this moment, there doesn't seem to be a solution to this particular problem within Appsmith.