cancel
Showing results for 
Search instead for 
Did you mean: 

Want to populate a date field with the value from another date field.

Former Member
0 Kudos

Hi,

I have two date fields in a webdynpro application. When i select the date from calendar and populate one date field i want to populate the same date to the another date field.

Can this be possible.

Please do ans.Helpful ans will be rewarded,

Thanks

Ritushree

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Create a calculated attribute of type date and bind this to the first datefield,

When ever their is a change, the getter method is called with a param "value". This will give you the new value, assign this to the other attribute.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Can you please help me out with some step wise example.

This is an urgent issue.

Thanks

Ritushree

Former Member
0 Kudos

Hi,

Create an attribute lets say Date1 of type date make it calculated, to do this from the properties of the attribute

set the property calculated to true

set the property readOnly to false.

create another attribute Date2 of type date.

when you make an attribute calculated you will see the set/get methods generated for that attribute , in our case


public void setDate1(IPrivateTestCompView.IContextElement element, java.lang.String value)
  {
    //@@begin setDate1

     // assign the value entered by the user to the second date field

  wdContext.currentContextElement().setDate2(value);
    //@@end
  }

bind both attributes Date1 and Date2 to respective UI elements

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

I have tried the example . But of no help . Please help.

Former Member
0 Kudos

Hi Ritushree,

I think the calculated attributed is the only way to do this. what exactly u have done for that & whats the problem u r getting. send the code as well if possible.

regards

Sumit

Former Member
0 Kudos

Hi Sumit,

Should the second context date2 be calculated attribute?

I have followd the same steps.

Step : create two input field.

Step 2 : create 2 context attributtes toDate and endDate.

Step 3 : the property calculated of toDate is set to true.

Step 4 : in the implementation method of setToDate(Element,value){

/ wrote the same code

}

Step 5: Bind the context attributes to respective UI elements.

Could any one send any example document to ritushree.saha@in.ibm.com.

Thanks

Ritu

Former Member
0 Kudos

Hi,

I don't want to use onEnter event.

Former Member
0 Kudos

Hi,

Why you dont want to use onEnter Event.

Regards,

Sudhir

Former Member
0 Kudos

Hi,

Bind the two input fields with the same context attribute ex.myDate.

Regards,

Sudhir

Former Member
0 Kudos

Hi,

Assigning input fields to the same context dosn't work.

Thanks

Ritushree

Former Member
0 Kudos

Hi,

I think using onEnter event handler is the only way to achieve this.

Regards,

Sudhir

Former Member
0 Kudos

Of course you can bind different input fields to the same context attribute. The fields will be in synch after any server round-trip. That means if you use a date picker to populate one field you need to trigger some action (e.g. the onEnter action) to sync both field contents.

Armin

Former Member
0 Kudos

Hi,

In the onEnter action handler,get the selected date and assign the date to the Inputfield, which you want to populate with the same date.

Regards,

Sudhir.