Forums: [SOLVED] Rules on dates - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] Rules on dates Rules on dates Rate Topic: -----

#1 User is offline   ijunior 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 01-June 19

Posted 13 June 2019 - 11:56 PM

Good night
I need to put a rule on inserting dates.
Example: The start date can not be less than the current date.
Can you help me?
0

#2 User is offline   timnorvel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 290
  • Joined: 21-September 07
  • Gender:Male
  • Location:Minnesota, USA

Posted 14 June 2019 - 01:02 PM

You can do this in the "Before record added" event. Here is an example from the help file:

https://xlinesoft.co...n_end_date_.htm

You could also do it in javascript if you wanted it to happen as they change the field.

Good luck.
Tim
0

#3 User is offline   jadach 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 467
  • Joined: 26-April 08
  • Gender:Male
  • Location:New York

Posted 14 June 2019 - 01:34 PM

DateTime dt1 = DateTime.Parse(values["StartDate"].ToString());
DateTime dt2 = DateTime.Today;

if (dt1.Date < dt2.Date)
{
message = "Start date cannot be less than current date";
return false;
}
else
{
return true;
}

-jerry
0

#4 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16451
  • Joined: 03-February 03
  • Gender:Male

Posted 14 June 2019 - 03:03 PM

In version 10.2 we implemented Date Control API that makes things like this easier.
https://xlinesoft.co...nerpro-is-here/

We will have documentation on this topic available in a couple of days. For this specific task you can use the following code in Javascript onload event:


var ctrl = pageObj.getControl("DateField");
ctrl.setAllowedInterval( Date.now() , null );

Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users