• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: How do I pre-fill a calender pop field with date?

How do I pre-fill a calender pop field with date? 16 years 6 months ago #5181

  • rolf.fey
  • rolf.fey's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
I do have multiple date fields (pop up) and initially they are all empty. How can I fill each field with a certain date? In most cases just the actual date as default?
Thanks for advice,
Rolf
The administrator has disabled public write access.

Re:How do I pre-fill a calender pop field with date? 16 years 6 months ago #5244

  • octavian
  • octavian's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 783
  • Thank you received: 110
Hello,

Disable the autogenerate layout feature from the Form Layout tab. After that, paste this code at the end of the layout:
<script type="text/javascript">
var mydate=new Date();
var day=mydate.getDate();
var month=mydate.getMonth();
var year=mydate.getYear();
if (year < 1000) year+=1900;
if (day<10) day=\"0\"+day;
month = parseInt(month) + 1;
if (month < 0) month = \"0\"+month;
document.getElementsByName('form[Calendarname]')[0].value = day + '.' + month + '.' + year;
</script>
The only thing you need to replace is the Calendarname with your component's name.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Re:How do I pre-fill a calender pop field with dat 16 years 6 months ago #5284

  • rolf.fey
  • rolf.fey's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Perfect advice! Since I am not fluent in Javascript I appreciate this support. Works perfect now.
Maybe this could be an option for a date field type.
Then the calendar has no option to jump year by year. If one person has to enter his birthdate, the calender option is not suitable. It should be possible to jump in one year intervalls, not just month intervalls.

Thank you for such a great component.
With regards
Rolf
The administrator has disabled public write access.

Re:How do I pre-fill a calender pop field with dat 16 years 6 months ago #5338

Thanks this has helped me also. I too am using the pop-up calendar for a Date of Birth field and moving the calendar by year would be beneficial for sure!

Many thanks,
Ryan
The administrator has disabled public write access.

Re:How do I pre-fill a calender pop field with dat 16 years 6 months ago #5365

Great advice above. I successfully pre-filled the field with the necessary date, but how can I enable the calendar to also popup with the necessary date (March 13, 2009)? The calendar defaults to the current day.
The administrator has disabled public write access.

Re:How do I pre-fill a calender pop field with dat 16 years 6 months ago #5397

Anybody have any advice on this?
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!