**SOLVED**range limit in field

marklandry 04 Sep, 2011
Hi, I have an input field that needs to only accept a certain numeric range, for example, you can't input anything greater than "9"

I know I can do it with JS but not sure exactly what the syntax would be. The following won't work..

function validateForm()
{
var x=document.forms["text_0"].value;
if (x<=9)
  {
  alert("you cannot get lower than a 9 on this game");
  return false;
  }
}


I'm not sure where to go from here... Thanx for your help.

Mark
marklandry 04 Sep, 2011
Sorry, found Bob's post on Server Side Validation and entered this:

<?php
if($_POST['text_0'] > 20)
return 'Sorry, you cannot score more than "20" in the STAR Game.  Please enter a score of 20 or less';
?>


Working fine now...
This topic is locked and no more replies can be posted.