So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By potz
#72728 Hi,

The key TEST is ok. But the radio button are not working. I never see on the serial monitor RED ON or RED OFF.

What is wrong ?

Code: Select all  key = -1;

  if (req.indexOf("/key1") != -1)
    key = 1;

  if (req.indexOf("/RED_OFF") != -1)
  {
    RED_State = false;
    Serial.println("RED OFF");
  }
  else if (req.indexOf("/RED_ON") != -1)
  {
    RED_State = true;
    Serial.println("RED ON");
  }


Code: Select all  if (key == 1)
  {
    Serial.println("key1");
  }

  client.println("<br>"); //aller a la ligne
  client.println("<button onClick=location.href='./key1\'>");
  client.println("TEST");
  client.println("</button>");

  client.println("<fieldset>");  //dessine un cadre
  client.println("<Radio button test</legend>");

  if (RED_State)
  {
    client.println("<form action='led'><input type=\"radio\" name=\"RedLEDState\" value=\"RED_ON\" checked=\"checked\"> ON"
                   "<input type=\"radio\" name=\"RedLEDState\" value=\"RED_OFF\"> OFF<br>");
  }

  else
  {
    client.println("<input type=\"radio\" name=\"RedLEDState\" value=\"RED_ON\"> ON"
                   "<input type=\"radio\" name=\"RedLEDState\" value=\"RED_OFF\" checked=\"checked\"> OFF<br>");
  }




Thanks
User avatar
By martinayotte
#72785 Your buttons doesn't do any thing since you didn't provided/attached any javascript code to them using onClick() attribute.
To ease the things, you could use some "microajax" calls.