Nate Parsons
|
Wednesday 27 September 2006 12:59:23 pm
I was unable to find any "eZPublish" way of doing this sort of validation, I ended up using javascript to validate the two form fields & modifying my form's action: <b>The Form Action</b>
action={concat("/content/edit/",$object.id,"/",$edit_version,"/",$edit_language|not|choose(concat($edit_language,"/"),''))|ezurl}>
<b>Javascript Example Code</b>
if(endUnixtime <= startUnixtime){
expMenu('error_start_end_date','show');
expMenu('error_display','show');
return false;
}
else{
if(endUnixtime > startUnixtime)
expMenu('error_start_end_date','none');
//Make sure that the end date is later than today
var endDate = new Date(yy,(mm-1),dd);
var today = new Date();
var year = today.getFullYear();
var month = today.getMonth();
var day = today.getDate();
var today = new Date(year,month,day,00,00,00);
var dateDiffDays = parseInt((endDate - today)/(1000*60*60*24));
if(dateDiffDays <= 0 ){
//alert('The end date must be later than today\'s date.');
//alert('Error2: dateDiffDays: '+dateDiffDays);
expMenu('error_end_today_date','show');
expMenu('error_display','show');
return false;
}
else{
expMenu('error_end_today_date', 'none');
return true;
}
}
}
function datetounixtime(yy,mm,dd,hh,min,sec){
var humDate = new Date(Date.UTC(yy,(mm-1),dd,hh,min,sec));
return (humDate.getTime()/1000.0);
---------------------------------------------------------------------------------
I look forward to an America which will not be afraid
of grace and beauty.
-------------JFK 10/26/63------------------------------------------------
|