Forums

Chrono Form calendar remove 'readonly' attribute

dagofee 04 Feb, 2011
Hello,
first things first, amazin job with this component, It's really a time saver, thank you!
I searched in the forum but only found a partial solution and after 2 Hours spent with 'grep' and 'egrep' I end up here.

How to allow users to write into the date-picker text area?
I really don't mind if they write there their age instead of a date, how to archive this?


thanks rfor any, any advice!
Andrea
GreyHead 04 Feb, 2011
Hi dagofee,

It took a bit of experimentation but this seems to work (goes in the Form JavaScript box):
window.addEvent('load', function() {
  $$('input.cf_datetime').each( function(el) {
    el.addEvent('click', function() {
      this.removeProperty('readOnly');
    }).el;
  });
});
This will remove the 'readonly' attribute from any datepicker in the form when you click on it.

Note: you then have to be very careful with validation if you need a date that is usable in code.

Bob
dagofee 06 Feb, 2011


T H A N K S
I already send you a beer
This topic is locked and no more replies can be posted.