Custom form with True/False switches or toggles

I have a lengthy collection that I want users to create records for. However, I need to insert headings inside the form to distinguish which section the user is doing. How would I go about creating the same functionality as the Adalo form component but with a custom form layout that allows me to insert my own text?

Hello :slight_smile: you can be more explicit ? or present an image if possible

Okay, so I have this simple collection for example:
image

In reality, my collection has 300 properties, consisting of my booleans properties and many input fields, across multiple areas. This means I need to include subheadings within my form to show the user which section they are currently filling, like so:

So my question is, can I include static text WITHIN the Adalo form component? If not, how do I store the value of a checkbox in memory so that when the user clicks submit, I can reference and identify the true or false values from the screen?

You can build your own form rather than using Adalo form component.

You’ll use toggles, text input fields, drop downs etc. Then at the bottom have a submit button with an action to update the collection based on these inputs you’ve placed on the page.

1 Like

Yeah, this is what I basically do for all “form” requirements in my apps. But I cannot see how to reference the toggle components on the page when creating my action.

Toggles themselves actually can work without a button action, unlike other form components, so they are saved as soon as clicked.

So it asks you what does this toggle:
“logged in user > X”
It can be used to toggle true/false properties

Thank you for your reply, but I still don’t understand what you mean.
Let’s say my collection has a text input property and two boolean properties, how would I use two toggles on a screen to collect the user’s answers for those two true/false questions?
Here you can see that I am unable to reference the toggles:

Whereas here I can reference the text input field on the screen:

Please tell me what I’m missing?

Oh you can’t set the toggle what to do in this screen. Because the record is creating in this screen. So that data is not available on this screen. Link it to another screen ( Like modal screen ) Then add the two toggles and you can set that record true/false property.

Like this.

Or you can use the form component.

Thank you

Thanks for the response, but again it doesn’t solve the problem at hand. My collection consists of over 300 properties, and many boolean questions that need to be ticked or left unticked based on real-time data collection from the field agent. And only at the END of the custom do I want to run an action to capture the survey. I’m very confused as to why the toggle or switch components cannot behave like an input field, storing what is inserted into it during the user interaction (left false or set to true if the user taps it)

After setting the true/false property to that toggle then that toggle is updating that record true/false property.

DMing you

Hi @sladerose,

Here is the thing: Toggle component changes some property’s value to True/False immediately. As I understand you’d like to have the following user flow:

  • firstly you display a form with 300+ questions, including T/F options
  • on the bottom of the form you’d like to have a “Submit” button to save the data.

If that’s the case, I see 2 options here:

Option 1: create temporary values to store the selections, usually you can do it in Users collection. Initialise these values before going to the questionnaire screen. Link the toggles&etc. to these values. For “Submit” button, add an action to create a Response record, copying the values from Logged-in User → all these properties to this Response record.

Option 2: I assume you have some “Responses” collection where you store all responses with 300+ values. You’ll need to:

  • Add one T/F property to this collection, call it “Response completed”.
  • On the screen before the questionnaire, on the button which leads to Patient Onboarding screen, add an action to create a New Response. Be sure to set the “Response completed” to False.
  • You can use standard or custom form on the “Patient onboarding” screen.
    → For the standard form, set it to “Update Current Response”.
    → For a custom-built form, be sure that Submit button updates Current Response with the values from the inputs. You can connect Toggles on the screen directly to Current Response.
  • then: when you click “Submit” button, be sure that you update Current Response → “Response completed” to True.

With this approach, you can treat only those responses as valid, which have “Response completed” set to True, and discard the other ones (may be clean them up manually or with a script). These “abandoned” responses will appear if patient walks away while filling in the questionnaire. To make database “cleaner”, you can add the Delete Current Response on the “Back” button on the Questionnaire screen (so if Patient decides not to fill it in and go back, no data is stored).

Hope this helps.

Best regards, Victor.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.