Repeating form component in mobile app?

Hi All!

Is it possible for a form to have repeating list components that can be referenced individually for database insertion?

I want to create a mobile app for teachers to take their class attendance. I am able to pull up the list of students for each teacher and include a select item where they can choose attendance value (present, tardy, absent). I wrapped this in a form object with the hope that I could reference the repeating list component in my SQL insert statement but the form1.data just shows up as null. Any thoughts on how (or if?!) I can achieve this?

For each item in the list, I want to be able to identify which student ID I am clicking on, and then the corresponding value in the select drop down. Is 'form data key' something that I should be using? Right now it is blank.

Custom collection views are currently unsupported with form.data -- if you want to refer to them in your SQL insert statement you'll need to use select1[0], select1[1], and so on.

@Jessica_D You could go about this differently, without using a form.

Method 1:

Simply attach an event handler to each select, to trigger a query that will set the attendance status of the respective student to the value of the select.

Like this, as soon as you select a status, the query is triggered and the student attendance updated.

This would also allow for a live counting of each status (the numbers would update as each status is marked):

You can access each item in the collection using {{item}}. So your student ID would be something like {{item.id}}. The corresponding select value would be exactly that : {{select1.value}} (where select1 in this case is the name/id of your select component).

To pass those parameters to a query, you can use additionalScope:

setAttendanceStatus.trigger({
  additionalScope:{
    student_id : item.id,
    attendance_status: select1.value
  }
})

(Your select event handler will have to be set to Run Script with the code above)

Method 2:

You could forego dropdown menus and go with icons, which can have their own event handler attached.

This would probably be more intuitive overall and require less clicks, since you can directly click a status without first having to open the select menu.

The setup is the same, except you need an event handler for each icon:

There's a few more steps to it all, like updating the icon color after the query runs and increasing the presence count shown in the screenshots, but that could also be done in several ways.

Give it a try :wink: .

2 Likes

what an absolutely fantastic and helpful reply! thank you! :grinning:

2 Likes