[GH-ISSUE #1623] Customfields saved values not display on portal #1381

Open
opened 2026-02-28 01:29:51 +03:00 by kerem · 8 comments
Owner

Originally created by @zstergios on GitHub (Jun 8, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1623

When I configure the settings are saved and everything works great, if I start the portal to change some settings, the last saved values are not display and default value is displayed.

The thrid parameter is default value.
I expected to see the last saved value instead. Is it bug or I missing something?

#BEGIN
  WiFiManagerParameter custom_weburl("weburl", "Web URL","https://NAME.domain.com", 128, "placeholder=\"Web URL\"");
  wm.addParameter(&custom_weburl);

  wm.setSaveParamsCallback(saveParamCallback);
  wm.setMinimumSignalQuality(10);
  wm.setConfigPortalTimeout(180);
  //wm.setConfigPortalBlocking(true);
#END

Debug Messages

messages here
Originally created by @zstergios on GitHub (Jun 8, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1623 When I configure the settings are saved and everything works great, if I start the portal to change some settings, the last saved values are not display and default value is displayed. The thrid parameter is default value. I expected to see the last saved value instead. Is it bug or I missing something? ```cpp #BEGIN WiFiManagerParameter custom_weburl("weburl", "Web URL","https://NAME.domain.com", 128, "placeholder=\"Web URL\""); wm.addParameter(&custom_weburl); wm.setSaveParamsCallback(saveParamCallback); wm.setMinimumSignalQuality(10); wm.setConfigPortalTimeout(180); //wm.setConfigPortalBlocking(true); #END ``` ### Debug Messages ``` messages here ```
Author
Owner

@tablatronix commented on GitHub (Jun 9, 2023):

you have to restore saved values, wm doesnt know what you saved

<!-- gh-comment-id:1583842841 --> @tablatronix commented on GitHub (Jun 9, 2023): you have to restore saved values, wm doesnt know what you saved
Author
Owner

@zstergios commented on GitHub (Jun 9, 2023):

How to restore them?

This way causes restarts

String getParam(String name){
  //read parameter from server, for customhmtl input
  String value;
  if(wm.server->hasArg(name)) {
    value = wm.server->arg(name);
  }
  return value;
}

and that way returns empty value probably because it's before adding the "custom_weburl" to wm.addParameter

  const char* url =  custom_weburl.getValue();
  WiFiManagerParameter custom_weburl("weburl", "Web URL",url, 128, "placeholder=\"Web URL\"");
<!-- gh-comment-id:1583973143 --> @zstergios commented on GitHub (Jun 9, 2023): **How to restore them?** This way causes restarts ``` String getParam(String name){ //read parameter from server, for customhmtl input String value; if(wm.server->hasArg(name)) { value = wm.server->arg(name); } return value; } ``` and that way returns empty value probably because it's before adding the "custom_weburl" to wm.addParameter ``` const char* url = custom_weburl.getValue(); WiFiManagerParameter custom_weburl("weburl", "Web URL",url, 128, "placeholder=\"Web URL\""); ```
Author
Owner

@zenz commented on GitHub (Mar 4, 2024):

if(wm.server->hasArg(name)) {
value = wm.server->arg(name);
}
return value;
}
there's a bug, since wm.server at that moment is equal to nullptr. then you cannot get the custom_field value.

<!-- gh-comment-id:1976030400 --> @zenz commented on GitHub (Mar 4, 2024): > if(wm.server->hasArg(name)) { > value = wm.server->arg(name); > } > return value; > } there's a bug, since wm.server at that moment is equal to nullptr. then you cannot get the custom_field value.
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2024):

What do you mean? Thats called in a callback whats the scope here?

<!-- gh-comment-id:1977768118 --> @tablatronix commented on GitHub (Mar 5, 2024): What do you mean? Thats called in a callback whats the scope here?
Author
Owner

@zenz commented on GitHub (Mar 5, 2024):

What do you mean? Thats called in a callback whats the scope here?

you can just try to compile and run the Advanced samples, while using custom_field, if you want to get custom_field value, it will crash, since wm.server is equal to nullptr.

<!-- gh-comment-id:1978014817 --> @zenz commented on GitHub (Mar 5, 2024): > What do you mean? Thats called in a callback whats the scope here? you can just try to compile and run the Advanced samples, while using custom_field, if you want to get custom_field value, it will crash, since wm.server is equal to nullptr.
Author
Owner

@tablatronix commented on GitHub (Mar 5, 2024):

Still not sure what you are calling, this happens in the example with no changes?

<!-- gh-comment-id:1979286054 --> @tablatronix commented on GitHub (Mar 5, 2024): Still not sure what you are calling, this happens in the example with no changes?
Author
Owner

@zenz commented on GitHub (Mar 6, 2024):

while compile and running this sample
https://github.com/tzapu/WiFiManager/blob/master/examples/Advanced/Advanced.ino

you will find that custom field value with name "customfieldid" cannot be get and store, at that moment calling wm.server, it's nullptr. you will never have a chance to use hasArg or arg to check and get the value.

<!-- gh-comment-id:1980042989 --> @zenz commented on GitHub (Mar 6, 2024): while compile and running this sample https://github.com/tzapu/WiFiManager/blob/master/examples/Advanced/Advanced.ino you will find that custom field value with name "customfieldid" cannot be get and store, at that moment calling wm.server, it's nullptr. you will never have a chance to use hasArg or arg to check and get the value.
Author
Owner

@tablatronix commented on GitHub (Mar 8, 2024):

But its only called from the callback is it not?

<!-- gh-comment-id:1984894909 --> @tablatronix commented on GitHub (Mar 8, 2024): But its only called from the callback is it not?
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#1381
No description provided.