cancel
Showing results for 
Search instead for 
Did you mean: 

Limit dates of a date inputfield

Former Member
0 Kudos

I have a inputfield bound to a context attribute of the type date. This gives me a date picker so the user can pick a date.

I want to limit the date choices the user has. How can i make sure that the user can only select the date from. lets say, today an on? But not a date before today.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

1. use date navigator

2. create two simple type of date

3. set value to that simple type in your init method min and max(may be todays date and after 20 years from today)

4. find firstselecteddate and last selecteddate property in your date navigator and bind it with those simple types.

Regards

Abhijith YS

Former Member
0 Kudos

Date today=new Date();

IYourNodeElement node=wdContext.createYourNodeElement();

if(!node.getYourDate()=today||node.getYourDate().beforeDate(today)){

....continue ur code

}

else{

wdComponentAPI.getMessageManager.reportWarning("Sorry can not accept a date less than todays date");

}

Regards

Abhijith YS

Former Member
0 Kudos

In this way you are not setting the min and max inclusive or exclusive of the simple type. This way you need a action to check what date is entered. I want to make it impossible for the user to enter incorrect values for the date....

Former Member
0 Kudos

Hi

You can make it using

Minimum Inclusive

Maximum Inclusive

Minimum Exclusive

Maximum Exclusive

with your type

Regards

Abhijith Ys

Former Member
0 Kudos

Can you tell me how to set these dynamicly?

Former Member
0 Kudos

hi

good

go through this link,hope this would help you to solve your problem.

http://www.apress.com/resource/bookfile/1030

thanks

mrutyun^