Form CustomValidate comparison with today's date

with dates are just a landslide.
here is my form_CustomValidate.

function(fobj) { // DO NOT CHANGE THIS LINE!
var data = new date();
**********here what I have to insert in order to compare today's date with the $row field ["data_ingresso"]****************************
	 var $row = $(this).fields(); // Get all fields
	 if ($row["data_uscita"].toJsDate() < $row["data_ingresso"].toJsDate()) // Assume Start and End are textboxes        
		 return this.OnError($row["data_uscita"], "La data di uscita non può essere minore dell'Ingresso."); // Return false if invalid
return true; // Return true if valid

	 if ($row["data_ingresso"].toJsDate()< data) // Assume Start and End are textboxes        
		 return this.OnError($row["data_ingresso"], "Per Cambiare lo Storico Uscita rivolgersi all'amministratore."); // Return false if invalid
return true; // Return true if valid

if ($row["data_ingresso"].toJsDate()< $data) // Assume Start and End are textboxes        
		 return this.OnError($row["data_ingresso"], "Per inserire un ingresso antecedente alla data di ieri rivolgersi all'amministratore."); // Return false if invalid		 
return true; // Return true if valid
 }

thanks in advance for your help

i solved it differently, (but i hope you can help me in form_custom_validate). I have worked with Row_inserting, with error message and it seems to work well. Although I prefer to work in Form_custom_validate for the focus on the field.
It works, only the administrator can enter all the dates.
I await help for the first post, thanks for everything for the moment.// Row Inserting event
function Row_Inserting($rsold, &$rsnew) {
// Enter your code here
// To cancel, set return value to FALSE
$dataieri = date(‘Y-m-d’, strtotime(‘-1 day’));
$datadomani = date(‘Y-m-d’, strtotime(‘+1 day’));
if(CurrentUserLevel() > 0 && ($rsnew[“data_ingresso”]>=$dataieri && $rsnew[“data_ingresso”]<$datadomani)){
return TRUE;
}else if (CurrentUserLevel() == -1) {
return TRUE;
}
else{
$this->CancelMessage = “La Data Ingresso Deve Essere compresa tra IERI ED OGGI. Per correzioni dello Storico Rivolgersi all’amministratore”;
return FALSE;
}
}

Hi,

this is also not working by me.
The site give no error mesage. It just freeze.
I tried to implement it by row_inserting then it shows all the html code.

function(fobj) { // DO NOT CHANGE THIS LINE!
    // Your custom validation code here, return false if invalid.
     var $row = $(this).fields(); // Get fields as jQuery objects by field names
    if ($row["arbzsart"].toJsDate() > $row["arbzend"].toJsDate())      
        return this.addCustomError("arbzend", "The End Date must be later than the Start Date."); // Return false if invalid
    return true;
}

mpol_ch

mpol_ch wrote:

if ($row[“arbzsart”].toJsDate() > $row[“arbzend”].toJsDate()) >

Are you sure the field name “arbzsart” is correct?

Hi,it seems to be die datetime format.
I am using “dmYHi” then it does not working.
When set the value of “Date/Time named format” to dmYHis then the error message is working…Now, I activated option “Use Date/Time without seconds” under Tools/Advanced and let the “Date/Time named format” as “dmYHis”.
It seems to work…Thank you.