[GH-ISSUE #1030] Cannot change the html of a custom parameter #878

Open
opened 2026-02-28 01:27:28 +03:00 by kerem · 7 comments
Owner

Originally created by @GiPe66 on GitHub (Apr 6, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1030

Hi all,

I did not find any way to change the html of a custom parameter.

It is possible to get the html code of a custom parameter (getCustomHTML) but not to change it when it has been created.

I added a simple method to set it.

void WiFiManagerParameter::setCustomHTML(const char *custom) {
    _customHTML     = custom;
}

This allows changing a select /option in my case but also will help changing the radio button checked or any configurable html input in a non blocking mode web portal.

Thanks for your attention.

Originally created by @GiPe66 on GitHub (Apr 6, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1030 Hi all, I did not find any way to change the html of a custom parameter. It is possible to get the html code of a custom parameter (getCustomHTML) but not to change it when it has been created. I added a simple method to set it. ``` void WiFiManagerParameter::setCustomHTML(const char *custom) { _customHTML = custom; } ``` This allows changing a select /option in my case but also will help changing the radio button checked or any configurable html input in a non blocking mode web portal. Thanks for your attention.
Author
Owner
<!-- gh-comment-id:630477802 --> @dontsovcmc commented on GitHub (May 18, 2020): @GiPe66 please, see here: https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.cpp#L15 or here: https://github.com/tzapu/WiFiManager/blob/master/WiFiManager.cpp#L28 there are some examples of using: https://github.com/dontsovcmc/waterius/blob/master/ESP8266/src/setup_ap.cpp#L113
Author
Owner

@tablatronix commented on GitHub (May 18, 2020):

Also check out the /development branch childparamsclass example, it shows how to create custom params

https://github.com/tzapu/WiFiManager/blob/development/examples/ParamsChildClass/ParamsChildClass.ino

<!-- gh-comment-id:630486416 --> @tablatronix commented on GitHub (May 18, 2020): Also check out the /development branch childparamsclass example, it shows how to create custom params https://github.com/tzapu/WiFiManager/blob/development/examples/ParamsChildClass/ParamsChildClass.ino
Author
Owner

@TheNetStriker commented on GitHub (Jun 3, 2020):

I'm having the same problem. I've added a custom checkbox parameter, but I want to add the "checked" html attribute dynamically after the WiFiManagerParameter is initialized depending on the stored settings. The examples above only show how the custom html can be set when initializing the WiFiManagerParameter. Is there a way to change this after initialization or could this setter be implemented?

<!-- gh-comment-id:638116127 --> @TheNetStriker commented on GitHub (Jun 3, 2020): I'm having the same problem. I've added a custom checkbox parameter, but I want to add the "checked" html attribute dynamically after the WiFiManagerParameter is initialized depending on the stored settings. The examples above only show how the custom html can be set when initializing the WiFiManagerParameter. Is there a way to change this after initialization or could this setter be implemented?
Author
Owner

@tablatronix commented on GitHub (Jun 3, 2020):

you can use param.setValue and change it at anytime via the param reference

<!-- gh-comment-id:638217766 --> @tablatronix commented on GitHub (Jun 3, 2020): you can use param.setValue and change it at anytime via the param reference
Author
Owner

@tablatronix commented on GitHub (Jun 3, 2020):

see the dev example

  // set values later if you want
  custom_html.setValue("test",4);

There is no param callback atm so you might have to figure out when some other way

<!-- gh-comment-id:638219006 --> @tablatronix commented on GitHub (Jun 3, 2020): see the dev example ``` // set values later if you want custom_html.setValue("test",4); ```` There is no param callback atm so you might have to figure out when some other way
Author
Owner

@TheNetStriker commented on GitHub (Jun 3, 2020):

@tablatronix I've already tried this, but this seem to only change the value of my custom parameter. The checkbox on the web page is still not checked when it is loaded. As a workarround I'm now initializing the custom WiFiManagerParameter in the setup() method after reading the json settings and set the checked attribute if needed:

custom_setting = new WiFiManagerParameter("id", "description", "value", 6, setting_enabled ? "type="checkbox" checked" : "type="checkbox"");

<!-- gh-comment-id:638287833 --> @TheNetStriker commented on GitHub (Jun 3, 2020): @tablatronix I've already tried this, but this seem to only change the value of my custom parameter. The checkbox on the web page is still not checked when it is loaded. As a workarround I'm now initializing the custom WiFiManagerParameter in the setup() method after reading the json settings and set the checked attribute if needed: custom_setting = new WiFiManagerParameter("id", "description", "value", 6, setting_enabled ? "type=\"checkbox\" checked" : "type=\"checkbox\"");
Author
Owner

@tablatronix commented on GitHub (Jun 3, 2020):

Ill have to check but you should be able to just override or add your own methods to change the custom html. I thought someone already made a checkbox example somewhere. But its not in the example

<!-- gh-comment-id:638371532 --> @tablatronix commented on GitHub (Jun 3, 2020): Ill have to check but you should be able to just override or add your own methods to change the custom html. I thought someone already made a checkbox example somewhere. But its not in the example
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#878
No description provided.