cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a button as Default

Former Member
0 Kudos

Hi All,

How can we make a button as default action. like, if i have a add button in the view and Whenever the user hits the enter key, the add buttons event should be fired. which fires the action assigned to the add button's event.

Thanks for your time.

- Raghavendra

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Raghavendra,

it is not possible to implement exactly scenario you described. But you can use following workaround:

1) Set button design as "emphasized" (Optional)

2) Call requestFocus for this button in wdDoModifyView for first time.

if (firstTime) {
    	final IWDButton button = (IWDButton)view.getElement("<ID_OF_BUTTON>");
    	button.requestFocus();
}

3) Assign the same action as for button to every inputfield.onEnter event.

final IWDAction onAction  = wdThis.wdGet<ACTION_NAME>Action();
//...get element
((IWDInputField)element).setOnEnter(onAction);

Best regards, Maksim Rashchynski.

Answers (2)

Answers (2)

Former Member
0 Kudos

Starting with release NW04s, you can set the default button for a UI element container via property "defaultButtonId".

Armin

Former Member
0 Kudos

Hi Maksim,

Thanks Rashchynski!! Workaround is pretty good to meet the requirement.

Thanks for your time...

- Raghavendra