What is the API schema for "checkbox" widget_type?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
Working on an emma integration, some of our clients have the "checkbox" widget_type in their fields.  I don't know how to create this widget type (rather than the check_multiple type) using the frontend or the API.  I tried guessing & POSTing a "checkbox" to the API, but the schema I posted must be wrong because it showed up correctly in my form.  What's the correct schema for it?  Or, how do I create a "checkbox" and not a "check_mulltiple" using the frontend?

Even if it's impossible to create new fields of this type, I need info to interpret the old ones, & the stack-traces I'm debugging off of only include the widget type name, unfortunately.
Photo of Leadpages Developer

Leadpages Developer

  • 5 Posts
  • 0 Reply Likes

Posted 2 years ago

  • 0
  • 1
Photo of Kyle Gregory | Lipscomb University

Kyle Gregory | Lipscomb University, Champion

  • 99 Posts
  • 69 Reply Likes
Hey @Leadpages Developer,

Looks like the widget type should be "checkbox". I noted you said you tried that and it didn't work. I just ran a test where I created a checkbox widget as a boolean (True/False in the app) and it went through successfully. Not much help, but I think you're in the right direction. Let me know if you have any more insights on your test, and I'll see if we can figure out the issue creating the field.

Thanks,
Kyle
Photo of Leadpages Developer

Leadpages Developer

  • 5 Posts
  • 0 Reply Likes
Thank you, Kyle.

However, I'm not seeing the option to create a boolean checkbox widget:


The checkbox menu requires a number of text options, instead of taking a boolean:


If I give it any options, this shows up in the API as `check_multi` rather than `checkbox`.

Can you give more complete instructions about how to create the `checkbox` widget type?

Also to re-iterate, I don't necessarily need to be able to create this widget if you can provide an example of what the `checkbox` field data looks like when retrieved through the API.  (The API docs have a couple examples, but *not* for `checkbox`.)
(Edited)
Photo of Leadpages Developer

Leadpages Developer

  • 5 Posts
  • 0 Reply Likes
Hi Kyle,

I've already read the API docs & attempted to POST a checkbox field, as mentioned in my initial query.  However, the API docs do not have the schema for what to submit for this exact type of field, and the data I submitted must have been wrong because  it did not work correctly in the form.  Please provide an example of the exact data to post, because the exact data required for a working checkbox field appears to be different from the field types written up in the docs.

Here's the (redacted) curl command I tried yesterday:

curl https://api.e2ma.net/<account-id>/fields -u <basic-auth> -d '{"shortcut_name": "justa-checkbox", "display_name": "Just a checkbox", "account_id": "<account-id>", "field_type": "boolean", "required": false, "widget_type": "checkbox", "short_display_name": "A checkbox?", "column_order": 210, "deleted_at": null, "options": null}'

This (surprisingly) resulted in a text field appearing in the form.
(Edited)
Photo of Kyle Gregory | Lipscomb University

Kyle Gregory | Lipscomb University, Champion

  • 99 Posts
  • 69 Reply Likes
Hey @Leadpages Developer,

The expected parameters are listed in the docs. Looks like that is a representation of the data within a full field, but Emma only expects five of them to create a field: shortcut_name, display_name, field_type, widget_type, and column_order. No parameters are listed as optional, but their example shows code with widget_type excluded. YMMV. Account ID is in the URL and is not expected in the data, as far as I know.

Here's my redacted cURL:

curl -H "Content-Type: application/json" -X POST -d '{"shortcut_name": "justa-checkbox","display_name": "Just a checkbox","field_type": "boolean","widget_type": "checkbox","column_order": 10}' -u <basic-auth>  https://api.e2ma.net/<account-id&g...

Hope that helps,
Kyle
Photo of Leadpages Developer

Leadpages Developer

  • 5 Posts
  • 0 Reply Likes
Hi Kyle,

As I mentioned earlier, when I create a checkbox field that way, it instead shows up as a text box.  I performed the command exactly as stated, and when I add it to my form, this is how it appears in the builder:

Photo of Kyle Gregory | Lipscomb University

Kyle Gregory | Lipscomb University, Champion

  • 99 Posts
  • 69 Reply Likes
Hey @Leadpages Developer,

I got you. You're using the lightbox forms. Yeah, I tested that and my checkbox field shows up as a text input. Might be that checkbox types are not supported by the lightbox forms, or it may be a bug. Looks like someone from Emma support will need to verify, but I think that's the case. If you check your classic forms, it will render as a checkbox.

Kyle
Photo of Leadpages Developer

Leadpages Developer

  • 5 Posts
  • 0 Reply Likes
Oh, I see, thank you.  Thank you for working with me to understand how this field works.
Photo of Grey Stepp

Grey Stepp, Support Team Manager

  • 1700 Posts
  • 135 Reply Likes
Hey guys!   Thanks so much for all the info there Kyle.  I'm going to do some testing on my end and check in with some of my more API savvy folks here to see what I can find out!

I know that the in-app created checkboxes do work in the lightbox forms as expected.  So there's something going on there with how they're being created via the API.  

Just wanted to let you know I've been keeping my eye on this and I'll post back with any answers I find.  

- G
Photo of Grey Stepp

Grey Stepp, Support Team Manager

  • 1700 Posts
  • 135 Reply Likes
Hey guys, I wanted to post an update here from the information I got:

There is difference here between the field he's trying to create and the normal checkbox field you can create in the app. 

The field that he's trying to use is actually called a Boolean field, which while looking and behaving similar to the in-app checkbox is different and is meant to act as a true/false deal instead of multiple options like the in-app one.

I believe we use that field exclusively for back-end integration stuff but like you said using the regular checkbox field with just one option should achieve the same thing. 

I hope this helps guys, and let me know if we need further clarification! 

- G