cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify a Date selection

Former Member
0 Kudos

Hi,

I have two date field, one is StartDate another is EndDate.

I want to calculate the EndDate once the StartDate is Selected.

Currently, I make use of the "Enter" properties which tag to the calendar (Date input properties). This generate a method in the view controller which allow me to place the calculation of the End Date.

When I select the StartDate from the calendar, it does not trigger the event Enter of the input date properties unless I hit the "ENTER" button of the keyboard. In additional, when I set the endDate, it has runtime error say that the value is not modifiable.

How do I make it such that when I select the desire StartDate (from the input calendar), it will trigger the event to calculate a endDate to display.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can give a try by making the attributes bound to the start date and end date as calculated.

Do your enddate calculation inside the setter of the beginDate.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi AyappaRaj;

I want to set date to a fixed value as 31/12/9999 and insert the record in backend. Please specify the code to assign the value to date attribute.

Please help.

Regards;

Anzar.

Former Member
0 Kudos

Hi,

To set date you can use this:



Calendar c1 = Calendar.getInstance();
c1.set(9999, 0 , 20); // 9999 jan 20

// the date from java.util namespace
Date fixedDte = new Date (cl.getTime());

Former Member
0 Kudos

Hi Ayyapparaj KV,

Can help in providing example for my scenario?

Thanks.

Regards,

cocomo

Former Member
0 Kudos

Hi,

What you can try is create a calculated attribute lets say StartDate of type Date and set the readOnly property false.

Once this is done you will get a method as follows



 public void setStartDate(IPrivateTestCompView.IContextElement element, java.sql.Date value)
  {
    //@@begin setStartDate
	  //accesing the EndDate and assigning startdate+10 as the value
	  	final Calendar calendar = new GregorianCalendar();
		calendar.setTime(value);
		calendar.add(Calendar.DATE, 10);
	   element.setEndDate(new Date(calendar.getTime().getTime()))
    //@@end
  }

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj KV,

The start Date is a Input field of Date. It has a selection of date. What should I do to set the endDate after a selection was made to the start date ?

can help?

Thanks.

Regards,

cocomo