Forums

Delete in Datetime Picker

pasqualedi 03 Mar, 2010
Hi!
I've a field with the DateTime Picker:
<input class="cf_datetime" title="" size="20" id="dsa" name="dsa" type="text" />


If i select the date after i don't delete this.
I need to delete the selected date.

Thank at all
GreyHead 20 Mar, 2010
Hi Pasqualedi,

Here's one solution . . . assuming that your datepicker has name & id='date_o'

Add a reset_date button to the form HTML
<!-- Date Picker -->
<div class="form_item">
  <div class="form_element cf_datetimepicker">
    <label class="cf_label" style="width: 150px;">Choose date</label>
    <input class="cf_datetime" title="" size="20" id="date_0" name="date_0" type="text" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<!-- Date Reset button -->
<div class="form_item">
  <div class="form_element cf_button">
    <input value="Reset date" name="reset_date" id="reset_date"type="button" />
  </div>
  <div class="cfclear"> </div>
</div>
and a little JavaScript snippet to the Form JavaScript box
window.addEvent('domready', function(){
  $('reset_date').addEvent('click', function() {
    $('date_0').value = '';
  });
});
When you click the 'Reset date' button the date field is cleared.

Bob
This topic is locked and no more replies can be posted.