URL decode float comparison

Basicaly, I have made a agent that is a simple web page to show a value set point.
I want to validate the value entered is between 55 and 104.

The code in bold dont work…I dont understand why

if (method == "POST") 
{
  data = http.urldecode(request.body);

  if(data.password==Password)
  {

    <b>if((data.newstpt>55)&&(data.newstpt<104))</b>
    {
      Setpoint_Value = data.newstpt;
      message ="New setpoint is now :" + Setpoint_Value + "Deg F" ;          
    }
    else
    {
      message ="Setpoint must be between 55 and 104 DegF" ; 
    }
    
  }
  else
  {
    message = "Password rejected";
  }
  
  
}
else
{
  message = ""
}

server.log(typeof(data.newstpt))

If the answer is “string” and not “integer” or “float”, then you should do something like:

data.newstpt = data.newstpt.tofloat();

If that’s not the problem, then you’ll have to go into more detail: show an example request.body, and describe exactly how it doesn’t work.

Peter

Peter you are right and now it work. Another question

Data.netstpt have to be a number, how can I validate that nobody enter text into this html input field ?

I’d say the easiest thing to do is validate it on the HTML side:
http://www.w3schools.com/js/js_validation.asp