Links

Set the value of a checkbox element

cURL
iOS SDK
Android SDK
PHP SDK
JS SDK
Flutter SDK
curl https://mburger.cloud/api/blocks/<id>/sections
-X POST
-H "Accept: application/json"
-H "Content-Type: application/x-www-form-urlencoded"
-H "X-MBurger-Token: <token>"
-H "X-MBurger-Version: 3"
-d 'elements[<locale>][checkbox]=<value>'
let factory = MBUploadableElementsFactory(localeIdentifier: "en")
let elements = [factory.createCheckboxElement(name: ELEMENT_NAME, value: true)]
​
MBAdmin.addSectionToBlock(withBlockId: BLOCK_ID,
elements: elements,
success: { sectionId in
},
failure: { error in
})
//SEND ONLY IF THIS CHECKBOX IS "TRUE"
val params = ArrayList<MBAdminGenericParameter>()
params.add(MBAdminCheckboxParameter(ELEM_NAME))
​
val addSectionListener = object: MBAdminAddSectionListener{
override fun onSectionAdded(section_id: Long) {
}
​
override fun onSectionAddedError(error: String) {
}
}
​
MBurgerAdminTasks.addSection(
context = applicationContext,
block_id = BLOCK_ID,
listener = addSectionListener,
params = params,
locale = Locale.getDefault().getLanguage());
// Work in progresscurl https://mburger.cloud/api/blocks/<id>/sections
-X POST
-H "Accept: application/json"
-H "Content-Type: application/x-www-form-urlencoded"
-H "X-MBurger-Token: <token>"
-H "X-MBurger-Version: 3"
-d 'elements[locale][element]'curl https://mburger.cloud/api/blocks/<id>/sections
-X POST
-H "Accept: application/json"
-H "Content-Type: application/x-www-form-urlencoded"
-H "X-MBurger-Token: <token>"
-H "X-MBurger-Version: 3"
-d 'elements[locale][element]'
// POST actions are not available atm on our JS SDK.
// If it could be interesting for you, please submit
// a feature request here:
// https://support.mburger.cloud/hc/en-us/community/topics/360000550497-Feature-Request?
MBUploadableElementsFactory factory = MBUploadableElementsFactory('en');
List<MBUploadableElement> elements = [
factory.createCheckboxElement(ELMENT_NAME, true),
];
await MBAdmin.shared.addSectionToBlock(BLOCK_ID, elements);
Value of
"elements[<locale>][checkbox]"
must be true or false for enabling or not the checkbox!