here is my Custom code action who doesnt work
the onchange action seems do nothing
<?php
$giorno_adesso = date('d');
$mese_adesso = date('m');
$anno_adesso = date('Y');
?>
<script language="javascript">
window.addEvent('domready', function() {
$('datebirth').addEvent('change', function() {
var date=document.getElementById("datebirth").value;
alert("data: "+date);
var anno=parseInt(date.substring(0,4),10);
var mese=parseInt(date.substring(5,7),10);
var giorno=parseInt(date.substring(8),10);
alert ("giorno "+giorno+" mese "+mese+" anno "+anno)
if((<?php echo $anno_adesso ?> - anno) > 18 ) { alert ("sei maggiorenne"); }
else if ((<?php echo $anno_adesso ?> - anno) < 18 ) { alert ("sei minorenne"); }
else if(((<?php echo $anno_adesso ?> - anno) == 18) && (<?php echo $mese_adesso ?> >= mese) && (<?php echo $giorno_adesso ?> >= giorno))
{ alert ("sei maggiorenne"); }
else { alert ("sei ancora minorenne"); }
});
});
</script>
this is the entire form field
<label for="datebirth">Data di nascita</label><input style="display: none;" id="datebirth" maxlength="150" size="16" class="validate['required'] cf_date_picker" title="" name="datebirth" value="2007-05-25" type="text"><input id="datebirth_clone_id" style="display: inline-block;" maxlength="150" size="16" class="validate['required'] cf_date_picker" title="" value="2007-05-25" type="text">
<div class="clear"></div><div id="error-message-datebirth"></div>
should i add #datebirth_clone_id somewhere to js function?