Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $col = array();
- $col["title"] = "FollowUp<br>Date"; // caption of column
- $col["name"] = "followUpDate"; // grid column name, same as db field or alias from sql
- $col["editable"] = true; // this column is editable
- $col["editoptions"]["placeholder"] = "YYYY-MM-DD";
- $col["editoptions"]["defaultValue"] = date("Y-m-d");
- $col["width"] = "70"; // Width of the column
- // $col["editrules"] = array("required"=>true); // this field is required
- // $col["editrules"] = array("date"=>true); //validation for the date format
- $col["editrules"] = array("custom"=>true,"custom_func"=>"function(val,label){return my_validation(val,label);}");
- $col["editoptions"] = array("onblur"=>"validate_onblur(this)");
- $cols[] = $col;
- /*Script to check whether entered date is greater than Current Date */
- function my_validation(value,label)
- {
- var today = new Date();
- var dd = today.getDate();
- var mm = today.getMonth()+1; //January is 0!
- var yyyy = today.getFullYear();
- if(dd<10) {
- dd='0'+dd
- }
- if(mm<10) {
- mm='0'+mm
- }
- today = yyyy+'-'+mm+'-'+dd;
- if (value > today)
- return [true,""];
- else
- return [false,label+": Please enter a date which is greater than Current Date"];
- }
- </script>
Add Comment
Please, Sign In to add comment