diff --git a/lib/IotWebConf/src/IotWebConf.cpp b/lib/IotWebConf/src/IotWebConf.cpp index 8780095..528614d 100644 --- a/lib/IotWebConf/src/IotWebConf.cpp +++ b/lib/IotWebConf/src/IotWebConf.cpp @@ -362,7 +362,11 @@ void IotWebConf::setConfigSavedCallback(std::function func) this->_configSavedCallback = func; } +#ifndef USE_ESPASYNCWEBSERVER void IotWebConf::setFormValidator(std::function func) +#else +void IotWebConf::setFormValidator(std::function func) +#endif { this->_formValidator = func; } @@ -683,7 +687,11 @@ boolean IotWebConf::validateForm(AsyncWebServerRequest* request) boolean valid = true; if (this->_formValidator != NULL) { +#ifndef USE_ESPASYNCWEBSERVER valid = this->_formValidator(); +#else + valid = this->_formValidator(request); +#endif } // -- Internal validation. diff --git a/lib/IotWebConf/src/IotWebConf.h b/lib/IotWebConf/src/IotWebConf.h index 424a4d5..679c0a9 100644 --- a/lib/IotWebConf/src/IotWebConf.h +++ b/lib/IotWebConf/src/IotWebConf.h @@ -325,8 +325,11 @@ public: * If the method will return false, the configuration will not be saved. * Should be called before init()! */ +#ifndef USE_ESPASYNCWEBSERVER void setFormValidator(std::function func); - +#else + void setFormValidator(std::function func); +#endif /** * Specify your custom Access Point connection handler. Please use IotWebConf::connectAp() as * reference when implementing your custom solution. @@ -531,7 +534,11 @@ private: byte _apConnectionStatus = IOTWEBCONF_AP_CONNECTION_STATE_NC; std::function _wifiConnectionCallback = NULL; std::function _configSavedCallback = NULL; +#ifndef USE_ESPASYNCWEBSERVER std::function _formValidator = NULL; +#else + std::function _formValidator = NULL; +#endif std::function _apConnectionHandler = &(IotWebConf::connectAp); std::function _wifiConnectionHandler =