Date Validation K2 Smatforms

  • 10 March 2015
  • 3 replies
  • 72 views

Badge +7

Hi There,

 

I have a datetime control in a view in a form, I want to be able to set a condition that when the user clicks a button on a form, if the date entered is 1 day past the current date a message should show.

 

So far, I cannot edit the the feild values like I can in K2 studio, I cannot use a date in an expression and cannot see another way to achieve this, any ideas?

 

sudo

 

if(mydatefield < currentDate.adddays(2))

Show message

 

Cheers

 

Mat


3 replies

Userlevel 5
Badge +16

Hi,

 

what do you mean you can't use date in an expression??

 

set your expression on datalable and use the day difference expression, then check if the datalable value is less than zero

 

Check the attached images please :)

Hope it's useful 

 

 

 

 


13046i182BAFB4AFA707B1.png
13408i42499F9DBE99D74C.png
14775i91C7A38A98260710.png
Userlevel 4
Badge +13

Hi MrSafe,


 


You can have the following structure on your view:


Two calendar controls one set to invisible and bound to "current date" expression and the other will be used as the user input.


A button configured to an advanced condition rule that checks is the two calendar controls are not equal.


Then a messages it the advanced condition is found as true, which will display a message.


 


I seems that you want the user to only be able to enter the current date, so you also have th option to set the calendar control to a default


"current date" value and disable the control if you want to.


 


Kind Regards,


Raymond

Badge +6

HI, I have to compare two date time controls, Work From and Work To.

Work from should always be less than Work To, I inserted one Data lebal and build the attached exoression but how do I display the message to user for wrong data entered.

 

Regards,

Ram


15048i57CA3D2E033EC73A.jpg

Reply