cancel
Showing results for 
Search instead for 
Did you mean: 

get the text from button

Former Member
0 Kudos

Hello

I have few buttons in a view, for every button the text property is binded to a different variable in context, and all buttons have to execute the same action.

The question is: how can I get the text from the selected button?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Georgeta,

You should use in wdDoModifyView


final String       id  = element.getId();
final IWDButton button = (IWDButton)element;
button.mappingOfOnAction().addParameter( "actionID", id );

and add to your action handler new parameter

String actionID

.

Best regards, Maksim Rashchynski.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello

I had the same ideea to create an action for every button, but practicaly there are around 40 buttons in that view.

I found Maksim's ideea very elegant, and it is working very well now.

Thank you

Former Member
0 Kudos

Hi Georgeta,

The easiest way is to create different actions for each button. You can create a private method whic performs the action and can be called in each of these action methods. Under each action methods, you can get the corresponding text from the context for the view.

Regards,

Suresh.