Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Checkbox always return true #1836

@mylms

Description

@mylms

I am using a web interface with a checkbox. If I open the website (config portal), configure and save the settings, everything is fine.

However, if I do not save the settings or do not open the config portal at all (timeout), the values ​​from the checkboxes are always set to true.

Textbox or numeric box always work fine
Does anyone have any advice?

`
//PORTAL CONFIG
char time24hoursCheckbox[30] = "type='checkbox'";
if(mode24hour) strcat(time24hoursCheckbox, " checked");

WiFiManagerParameter config_cfg_mode1224("config_cfg_mode1224", "Mode 24 hours
", "T", 2, time24hoursCheckbox, WFM_LABEL_AFTER);
wm.addParameter(&config_cfg_mode1224);

//PoRTAL START
wm.setConfigPortalTimeout(60);
wm.setConfigPortalBlocking(true);
wm.startConfigPortal("ClockCfgPortal");

//GET DATA FROM PORTAL
mode24hour = (strncmp(config_cfg_mode1224.getValue(), "T", 1) == 0);
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions