• 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: Calendar with Time constraint

Calendar with Time constraint 9 years 11 months ago #31186

  • xcept
  • xcept's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hey guys,

I looked around the whole forum and found:

<script type="text/javascript">
function rsfp_onSelectDate(selectedDate)
{
currentDate = new Date();
month=currentDate.getMonth() + 1;
today = currentDate.getDate() + "." + month + "." + currentDate.getFullYear();
hours = currentDate.getHours();
if(selectedDate == today && hours >= 10)
{
alert('enter your invalidation message here');
return false;
}
return true;
}
</script>


Though it doesn't seem to work!

what i need is that the form cannot be submitted if the date is set to today after 14:00 / 2PM - anybody can help me how to approach the RSform plugin on this ? Thanks
The administrator has disabled public write access.

Calendar with Time constraint 9 years 11 months ago #31202

  • bogdan.tataru
  • bogdan.tataru's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 174
  • Thank you received: 40
In order to achieve this head to Components > RSForm!PRO > Manage Forms > select you form. In the Properties tab click on CSS & Javascript and add the following script in the Javascript field:
<script type="text/javascript">
function myFunction()
{
var selectedDate=document.getElementById('txtcal4_0').value;
var currentDate = new Date();
var month=currentDate.getMonth()+1; 
if(month<10){
month="0"+month;
}
var today = currentDate.getDate() + "." + month + "." + currentDate.getFullYear();
var hours = currentDate.getHours();
 
if(selectedDate == today && hours >= 14)
{
alert("Your error message!");
return false;
}
return true;
}
</script>

This function must be triggered by your submit button. So, switch to Components tab and add the following trigger on the Additional Attributes of your submit button:

onclick="return myFunction();"
My help is not official customer support. To receive assistance, submit a ticket by clicking here
Last Edit: 9 years 11 months ago by bogdan.tataru.
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!