cancel
Showing results for 
Search instead for 
Did you mean: 

Set an on enter event to a field dynamically

former_member205144
Active Participant
0 Kudos

Hi,

How can i set an action on On Enter for all the attributes dynamically?The attributes are created statically only.

Accepted Solutions (1)

Accepted Solutions (1)

chengalarayulu
Active Contributor
0 Kudos

Lavanya,

for input field, we can assign an event/action to that..

if it is new dynamic InputField, 

refer CL_WD_INPUT_FIELD class, method NEW_INPUT_FIELD-ON_ENTER(parameter)

If it is Static, already created InputField..

CL_WD_INPUT_FIELD - Method - MAP_ON_ENTER or SET_ON_ENTER

former_member205144
Active Participant
0 Kudos

let me try.....

Answers (3)

Answers (3)

amy_king
Active Contributor
0 Kudos

Hi Iavanya,

You cannot give all UI elements an onEnter event since only certain elements have this event. UI elements have only specific events for certain key presses. For example, InputFields have an event onEnter for when the ENTER key is pressed. But not every UI element and not every keyboard key has a corresponding event that can be triggered.

If you want to give your InputField elements onEnter events, the events don't need to be created dynamically. You can assign the same event or a different event to the fields, then in the action handler method for the event you can perform whatever logic you need.

Cheers,

Amy

former_member205144
Active Participant
0 Kudos

I mean,on enter on all the input fields only....Is it possible to set an action on OnEnter dynamically?

chengalarayulu
Active Contributor
0 Kudos

Lavanya,

above mentioned scenerio will work.

amy_king
Active Contributor
0 Kudos

Hi Iavanya,

Yes, it is possible and the approach given by Chengalarayulu should work for you. I wonder though why you need to create the events dynamically? You could statically assign the onEnter events to each InputField and then do your  logic for how to handle the event in the action handler method. The action handler method can even choose to do nothing with the event if that is one of your scenarios.

Cheers,

Amy

former_member185241
Active Participant
0 Kudos

Hey Lavanya,

Why do you need to bind onaction methods to ui element Dynamically?

Can you elaborate a little bit more, so that i can think about your problem and can give you best solution as per my knowledge.

thanks

Abhishek

Former Member
0 Kudos

Hello Lavanya,

I don't think so it's possible in Webyndpro for ABAP , Event triggering parts are already handles by Frame work and OnAction Events ( like..Modify , Init etc.. ) will be called automatically.

If you need a code on Enter event try putting the code inside the WDMODIFY method.

Thanks

~Raj