Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Customization of buttons in bootbox prompt not working #290

Open
stjephan opened this issue Mar 16, 2016 · 3 comments
Open

Customization of buttons in bootbox prompt not working #290

stjephan opened this issue Mar 16, 2016 · 3 comments

Comments

@stjephan
Copy link

Need to change the content of the "ok" button.

@stjephan stjephan changed the title Customization of buttons in bootbox not working Customization of buttons in bootbox prompt not working Mar 16, 2016
@crevete
Copy link
Contributor

crevete commented Mar 16, 2016

Could you please give us some sample code?

@stjephan
Copy link
Author

I would like to add buttons with PromptOptions like:
PromptOptions options = PromptOptions.newOptions(message);
options.addButton("cancel", constants.cancel(), new SimpleCallback() {
@OverRide
public void callback() {
callback.callback(false);
}
});

Then I have the followin exception in browser
SEVERE: Uncatched exception in promise (Error) : button key bootbox_btn_0 is not allowed (options are cancel
confirm)

I need to modifiy the button contents

@crevete
Copy link
Contributor

crevete commented Mar 16, 2016

I've just realized the bootbox documentation is wrong...

http://bootboxjs.com/documentation.html#bb-prompt-dialog-options

  • For prompt, the title attribute is mandatory, but not message.
  • ONLY custom dialog can call addButton() to customize buttons (You can create a jsfiddle to prove it)

So the bug is: you should not call addButton from PromptOptions. But in your case, you have to use custom dialog, and cannot use prompt if you want to customize buttons.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants