cancel
Showing results for 
Search instead for 
Did you mean: 

InputField changed event?

Former Member
0 Kudos

Is there such an event (or ANY way) for me to capture when the value of an InputField has changed?

My problem:

I've retrieved a set of records into an input table. I have to keep track on inserts, deletes and updates. I can handle the initial states of all the input fields but how do I handle when state changes?

Example:

Retrieve 1 record

Insert another record

update the first record retrieved

So, what I have is an update for record 1 and an insert for record 2. If I can't change the status of each record when it changes,(from notmodified to modified), how do I know to update?

Thanks,

Andrew

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Andrew,

Actually, I see 2 options:

1. Create JavaBeans model classes using corresponding WebDynpro model import wizard, track changes in every JavaBean your self. -- if you may alter "record" class.

2. Freeze a snapshot of loaded data, clone loaded data to work data, modify work data, before submit compare snapshot and work data. -- if you may not alter "record" class.

VS

Former Member
0 Kudos

Valery,

Good suggestions... Too bad NDS doesn't have a control that would handle this type of coding.

I did PowerBuilder development for years and they had the concept of a datawindow which was based on a select statement to a database backend. It does pretty much what you are stating in that it kept track of the original values of each cell and also the state of the cell. The states were New, NewModified, Modified, NotModified, Deleted. Based on all of these states, it handled the save automatically and new what to insert, update and delete.

It also had the ItemChangedEvent method and it would pass the new value as the argument so you could validate the input as it was being entered.

I could see that it would be possible to create a similar component like this but I don't have the time or the expertise.

Oh well, if anyone is bored and can create a tool like this, you could make a lot of money! Create a working set of components to import into your Dynpro applications and call it DynproTools. Let me know when you have it!

Thanks,

Andrew

Former Member
0 Kudos

Andrew,

I see no real difference here form regular JavaBeans programming:

1. You create a bean with a set of desired properties (pairs of getter/setter)

2. In every setter you compare value to original -- if both are equals returns simply, otherwise assign new value and update some internal long field <i>version</i>

3. Implement <i>version()</i> method for bean, that simply returns version.

4. After loading collect original version of beans into snapshot of type java.util.IdentityHashMap(key -> bean, value -> version)

5. On submit you can verify:

a) bean modified -- it exists both in snapshot and working set and has non-equal version

b) bean deleted -- it exists in snapshot only

c) bean created -- it exists in working set only

6. The only WD-specific part: import set of your JavaBeans as WebDynpro model using wizard.

VS

P.S. Task you try to accomplish is very similar to one implemented by CAF framework for UI -> Business Objects access (keywords CAF, ESF, COOL). Try get more info on CAF forum -- probably it is exactly what you need.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Andrew,

you cant capture the change in InputField value just by catching normal key strokes. Though if the user presses the Enter button after changing the data in the infupField, you can catch tht by creating an Action and mapping that with the onEnter property of the InputField.

Regards,

Shubhadip

Former Member
0 Kudos

Hi Andrew,

I don't think it is possible to capture the change of values in the InputField, as it is not possible to capture the events of the keys through WebDynpro.

Hope there might be some other ways for that.

Regards

Noufal