Open ideaChenGo opened 6 years ago
fngstudios commented on 11 Aug 2017 sorry ,i begin use github,no idea @fngstudios . just copy to here. This is what I did for the bool parameters:Added the getType method to WiFiManagerParameter and modifyed the constructor: WiFiManagerParameter::WiFiManagerParameter(const char id, const char placeholder, const char *defaultValue, int length,bool isBoolean) { .._isBoolean = isBoolean;. } bool WiFiManagerParameter::getType(){return _isBoolean;}
Then when you render the parameters: // add the extra parameters to the form for (int i = 0; i < _paramsCount; i++) { if (_params[i] == NULL) {break;} if (!_params[i]->getType()){ String pitem = FPSTR(HTTP_FORM_PARAM); pitem.replace("{i}", _params[i]->getID()); pitem.replace("{n}", _params[i]->getID()); pitem.replace("{p}", _params[i]->getPlaceholder());snprintf(parLength, 2, "%d", _params[i]->getValueLength()); pitem.replace("{l}", parLength);pitem.replace("{v}", _params[i]->getValue());page += pitem; }else{ String pitem = FPSTR(HTTP_FORM_BOOL_PARAM); pitem.replace("{i}", _params[i]->getID()); pitem.replace("{n}", _params[i]->getID()); pitem.replace("{p}", _params[i]->getPlaceholder());snprintf(parLength, 2, "%d", _params[i]->getValueLength()); pitem.replace("{l}", parLength); if (_params[i]->getValue()){ pitem.replace("{c}", "checked"); }else{ pitem.replace("{c}", ""); } page += pitem; }}
If we can make it as easy as adding "type" then maybe
This would be really REALLY useful, is there any plan on adding something like this?
134
Hello Could you make the PR to show how you solved your task? I think that boolean parameters at the configuration portal will be useful for others. Yeas, we have an ability to add custom html and css, but it would be ok to have also the default way to make basic html objects/labels/radiobuttons/etc (like in Twitter Bootstrap).
I think, boolean parameters with radiobuttons could be look like these: idea
And it seems to be ok to add a type of form label for custom parameters like:
// id/name, placeholder/prompt, type, default, length
Maybe it needs to make a new handler for these inputs to store data depends on element type (e.g. store boolean in json for radiobutton elements).
what do you think?