-->
Page 1 of 3

Radio button not working

PostPosted: Wed Dec 27, 2017 9:15 am
by potz
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

Re: Radio button not working

PostPosted: Sat Dec 30, 2017 6:05 am
by potz
no idea?

Re: Radio button not working

PostPosted: Sat Dec 30, 2017 9:16 am
by martinayotte
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.

Re: Radio button not working

PostPosted: Sun Dec 31, 2017 3:02 am
by potz
Thanks martinayotte. But I don't know what microajax is? How do I implement that on my C code ?

Thanks