Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By FRANCISCOGIMENO1000
#80669 Hi, I have a question that maybe someone can tell me how to do it.

In one esp8266 teng a simple web with a form that there are 2 radio type selection buttons and two input boxes and the form submission button.

This would be the default scheme 1:
radio button 1: checked
radio button 2: not checked
Text in the input box 1: Hello

The client loads the web modifies the values and sends them, diagram 2:
radio button 1: not checked
radio button 2: checked
Text in input box 1: goodbye

(It is assumed that the new values are received and stored in variables in the esp8266)

As it is done so that when the client loads the page again, the data of the schema 2 will appear, which is what has been modified and saved and not those of the schema 1 that were the ones that were by default.

How variable values are embedded within the html text to modify the selection of the radio buttons and the input box text.

Greetings and thank you.
User avatar
By btidey
#80670 There are multiple ways to do this which depend on how you are serving the web page in the first place.

1) If you are just returning a file like index.html stored in SPIFFS then you could obviously just edit the file when the values change.

2) If you respond to the request by reading the file in the app code, then you could embed your own variable indicators like !!radio1!! in the SPIFFS file and then replace these by real values when the server reads the file and then returns the modified file to the client.

3) You could embed some javascript code with the page that made requests to the server to retrieve the current data values and update the web page accordingly.

Method 3) gives the most flexible way and allows dynamic updating of any values on the client's web page as things change on the server. Referencing a jQuery library (e.g. http://code.jquery.com) makes this even easier to achieve.
User avatar
By rudy
#80675
How variable values are embedded within the html text to modify the selection of the radio buttons and the input box text.


I send out a static page with some Javascript, without current values, then I use AJAX to fill in the current values. If I were at home I would post an example. It has a lot of other stuff in it, and some is messy. It is a work in progress. Working but I have more plans for it.

The application is for powering the block heated in my car. I have a form for setting the start and stop times, and radio buttons to enable or disable the timer. I have a form on another page for setting the unit name.

The static pages I store in flash with the raw string literal method so the page does not need to be loaded into ram. If they were first loaded into ram I could them modify the data before sending out the complete page, but I didn't want to use ram. So I send out the page and modify the content afterwards.

I'm at work right now so the above a bit fragmented, I don't have time to make it more clearer.