Text input box

118 views
Skip to first unread message

Gman

unread,
Sep 28, 2010, 7:52:30 PM9/28/10
to Webduino
Hi
I wanted to be able to set variables through a form so I added the
text box function to my library.

You need to add these two functions to the library (WebServer.h) to
use it.

// output HTML for a textbox
void textBox(const char *name, const char *val,
const char *label, bool selected);

void WebServer::textBox(const char *name, const char *val,
const char *label, bool selected)
{
outputCheckboxOrRadio("textbox", name, val, label, selected);
}

Once that is done it is used in much the same way as a radio button or
checkbox

tempstring = 25;
itoa(controlON, tempstring , 10);
server.textBox("TempControlON", tempstring , "On Temp", 0);

This will show a textbox with the value of 25 in it, and a label of On
Temp, the name is TempControlON when returned from a form submit, the
selected variable (value 0) is just there to make for easier
compatibility with the checkbox or radio code. It can be 1 or 0 and is
ignored.
Reply all
Reply to author
Forward
0 new messages