Guest User

Untitled

a guest
Apr 28th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. $col = array();
  2. $col["title"] = "FollowUp<br>Date"; // caption of column
  3. $col["name"] = "followUpDate"; // grid column name, same as db field or alias from sql
  4. $col["editable"] = true; // this column is editable
  5. $col["editoptions"]["placeholder"] = "YYYY-MM-DD";
  6. $col["editoptions"]["defaultValue"] = date("Y-m-d");
  7. $col["width"] = "70"; // Width of the column
  8. // $col["editrules"] = array("required"=>true); // this field is required
  9. // $col["editrules"] = array("date"=>true); //validation for the date format
  10. $col["editrules"] = array("custom"=>true,"custom_func"=>"function(val,label){return my_validation(val,label);}");
  11. $col["editoptions"] = array("onblur"=>"validate_onblur(this)");
  12. $cols[] = $col;
  13.  
  14.  
  15.  
  16.  
  17. /*Script to check whether entered date is greater than Current Date */
  18. function my_validation(value,label)
  19. {
  20. var today = new Date();
  21. var dd = today.getDate();
  22. var mm = today.getMonth()+1; //January is 0!
  23. var yyyy = today.getFullYear();
  24.  
  25. if(dd<10) {
  26. dd='0'+dd
  27. }
  28.  
  29. if(mm<10) {
  30. mm='0'+mm
  31. }
  32.  
  33. today = yyyy+'-'+mm+'-'+dd;
  34. if (value > today)
  35. return [true,""];
  36. else
  37. return [false,label+": Please enter a date which is greater than Current Date"];
  38. }
  39. </script>
Add Comment
Please, Sign In to add comment