Controlling the calendar

A new function function can be used in order to increase the functionality of the calendar: rsfp_onSelectDate(). You will have to define this function inside your form, by going to the CSS and Javascript tab and adding the script between the tags. The following example will display an alert message when a certain date is selected from a pop-up calendar:


In the example on the right, the rsfp_onSelectDate() function is triggered when you click on a date from the pop-up calendar. If you select any other date other than 31.12.2010 the function will return false and the date will not be selected. When you choose the correct date, an alert message will be displayed and the value you have selected will be added in the calendar field's input box.

<script type="text/javascript">
function rsfp_onSelectDate(selectedDate)
{
  if(selectedDate == "31.12.2010") 
  {
    alert("Happy New Year!");
    return true;
  }
  else return false;
}
</script>

Calendars field components used in RSForm!Pro can be accessed through JavaScript. The syntax used for this is:

RSFormPro.YUICalendar.calendars[formId][calendarName]

This will return all properties for that specific calendar. Please note that the "formId" is the ID of the form where the calendar is used and the "calendarName" is the calendar's exact name.


7 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that

You Should Also Read

Custom PHP code HOT

Display PHP variables by default when form is shown HOT

Custom validation rules HOT

PHP Scripts HOT

How can I prevent the user from selecting a date in the calendar field HOT