I am trying to switch things (currently a led) from a web page. Thanks to zoomkat, I am well along. I could switch the led on/off with a ext field, now I am trying radio buttons. There are two problems
- you seem to be able to have two buttons clicked at once
- nothing gets back to the server
I am creating the buttons thusly
client.write("Led Off ");
client.write("Led On ");
The ino is much too big so I am attaching it as a zip
To see the page go to hodgers-house.com
testserver.zip (2.29 KB)
Try something like this. All buttons in a group must share the same name.
client.write("<form>Led Off <input type=radio name=led value=off>");
client.write("Led On <input type=radio name=led value=on></form>");
Retrieve variable led on the server. It will be set to on or off.
I'd use the full syntax, to be HTML / XHTML agnostic, and be explicit about action and method:
client.write("<form method='...' action='...'>Led Off <input type='radio' name='led' value='off' />");
client.write("Led On <input type='radio' name='led' value='on' /></form>");
IIRC a form without an action attribute will behave differently on different browsers.
[edit: Oh, and where's the submit button? ]