Examples to configure some user's parameters from web page

#1

Hello!)
I want to set some config parameters (for example: mqtt server, login and password and others) with a help of web page and to save them in conf9.json. Are there any examples to do these?

#2

wifi-setup-web-ui libray might be a starting point.

#3

Is it possible to use web functions with c/c++ only, without JS and RPC?

#4

What do you mean by “web functions with c/c++ only, without JS and RPC” ?
Your web page code runs on the browser, it connects to the device to get information, it does that by requesting it issuing a POST or a GET to an URL. That URL needs to somehow trigger the execution of a function. In most web servers that is called CGI, mOS uses a Remote Procedure Call scheme that can be accessed through many transports, not only HTTP but WebSockets, serial port, MQTT; so in the device, that request is handled by an RPC. The RPC code can be written in C/C++ or mJS, at your leisure.
Your device application code can also be written in (at least) C/C++ or mJS at your leisure, you can also call RPCs if you wish, but to control configuration parameters there are built-in C functions

#5

Thanks for your answer!..
I’m not so strong in programming and some program technologies, but I understood you!
Another question: How can I save some user data from web page to some local file, for example, user_data.txt?

#6

by calling FS.Put or writing your own RPC. If you check the example nliviu provided for you, you’ll see that.
That example seems to use WebSockets; there are other (probably easier) ways of doing that using some form of AJAX, using JSON (instead of XML). This example uses Zepto to simplify AJAX stuff.