Salve a tutti
Ho due textarea contenenti delle date. Vorrei controllare prima di dare il submit che non siano entrambe vuote e che la seconda data sia necessariamente maggiore della prima.
Scusate la banalità della domanda.. sono completamente a secco di nozioni di Javascript.
Allego sotto il codice per maggiore chiarezza: grazie in anticipo a chi vorrà aiutarmi !
Codice PHP:
<?php
$_SESSION['visualizza_pulsanti_sotto'] = "false";
?>
<link rel="stylesheet" type="text/css" media="all" href="include/calendar/calendar-green.css" title="green" />
<script type="text/javascript" src="include/calendar/calendar.js"></script>
<script type="text/javascript" src="include/calendar/lang/calendar-en.js"></script>
<!-- the following script defines the Calendar.setup helper function, which makes
adding a calendar a matter of 1 or 2 lines of code. -->
<script type="text/javascript" src="include/calendar/calendar-setup.js"></script>
<div class="selettore_wt">
<h2>Seleziona un intervallo temporale</h2>
<form name="formData" action="<?php echo $PHP_SELF; ?>" method="POST" >
[b]Dal :[/b]
<input type="text" name="data1" id="f_date_c" readonly="1" />
<button style="margin-bottom: 4px;" type="reset" id="f_trigger_c">...</button>
[b]Al :[/b]
<input type="text" name="data2" id="f_date_d" readonly="1" />
<button style="margin-bottom: 4px;" type="reset" id="f_trigger_d">...</button>
<script type="text/javascript">
Calendar.setup({
inputField : "f_date_c", // id of the input field
ifFormat : "%d-%m-%Y", // format of the input field
button : "f_trigger_c", // trigger for the calendar (button ID)
align : "Tl", // alignment (defaults to "Bl")
singleClick : true
});
Calendar.setup({
inputField : "f_date_d", // id of the input field
ifFormat : "%d-%m-%Y", // format of the input field
button : "f_trigger_d", // trigger for the calendar (button ID)
align : "Tl", // alignment (defaults to "Bl")
singleClick : true
});
</script>
</p>
<input name="annulla" type="submit" value="Annulla">
<input name="memorizza" type="submit" value="Fatto">
</form>
</div>