Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    How to validate time where to-time must be greater than from-time.

    Hi

    Code:
    var err_str="";
    function validate_grid(value,id,ind)
    {
     $("#result").html(" ").show();
     if(ind==1 || ind==2)
      {
      var patt=/^([0][0-9]|[1][0-9]|[2][0-3])[:]{1}[0-5][0-9]$/;
      if(!patt.test(value))
       {
    	mygrid.setCellTextStyle(id,ind,"background-color:yellow;");
    	if(err_str!="")
    		err_str+="\n"+(ind+1)+".Enter numbers and : only..";
    	else
    		err_str=(ind+1)+".Enter numbers and : only";
    	return false;
       }
        else
          {
    	mygrid.setCellTextStyle(id,ind,"background-color:white;");
    	return true;
          }
      }
    }
    alert(err-str);
    here ind==1 is from_time and ind==2 is to_time,i need to validate time as to_time must be always greater than from-time,if condition fails an alert msg should populate.time format is[05:00]as it is in string format im unable to do the validation for it.(ex:from-time=08:00 to-time=07:59 condition fails)

    thank you.
    Last edited by narinas; 01-18-2012 at 05:43 PM. Reason: modify


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •