Hi All,
while going through OO.ui.confirm dialog documentation I got curious about how to change the labels of the action buttons 'Ok' and 'Cancel' to show different texts.
-- Eugene
Hi,
Yes, it's possible to personalize the action labels via the `*actions`* option when constructing your message dialog. Wrote up something on this etherpad: https://etherpad.wikimedia.org/p/wrDQW6gSAqwWYwfL2tJb. Hope it's useful.
*--* *Derick*
On Thu, Dec 12, 2019 at 9:40 AM Egbe Eugene agboreugene@gmail.com wrote:
Hi All,
while going through OO.ui.confirm dialog documentation I got curious about how to change the labels of the action buttons 'Ok' and 'Cancel' to show different texts.
-- Eugene _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Note: With the `confirm()` method, a MessageDialog object is being created in the background. Altering that dialog at run time is almost impossible. So, the best way is go with constructing your own Message Dialog with the action labels you want as I shared above or other ways.
For more information from the JS side, see: https://stackoverflow.com/questions/823790/javascript-confirm-popup-yes-no-b... and other Google Search related results.
*--* *Derick*
On Thu, Dec 12, 2019 at 10:41 AM Derick Alangi alangiderick@gmail.com wrote:
Hi,
Yes, it's possible to personalize the action labels via the `*actions`* option when constructing your message dialog. Wrote up something on this etherpad: https://etherpad.wikimedia.org/p/wrDQW6gSAqwWYwfL2tJb. Hope it's useful.
*--* *Derick*
On Thu, Dec 12, 2019 at 9:40 AM Egbe Eugene agboreugene@gmail.com wrote:
Hi All,
while going through OO.ui.confirm dialog documentation I got curious about how to change the labels of the action buttons 'Ok' and 'Cancel' to show different texts.
-- Eugene _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can actually customize the labels in OO.ui.confirm() too:
OO.ui.confirm( '...', { actions: [ { action: 'accept', label: 'Yes!', flags: 'primary' }, { action: 'reject', label: 'No…', flags: 'safe' } ] } ).done( function ( confirmed ) { ... } );
Make sure to keep the `action: 'accept'` and `action: 'reject'` (the dialog uses this to make the two buttons do things), the other pieces can be changed.
Thanks very much for the suggestions.
On Fri, Dec 13, 2019 at 5:05 PM Bartosz Dziewoński matma.rex@gmail.com wrote:
You can actually customize the labels in OO.ui.confirm() too:
OO.ui.confirm( '...', { actions: [ { action: 'accept', label: 'Yes!', flags:
'primary' }, { action: 'reject', label: 'No…', flags: 'safe' } ] } ).done( function ( confirmed ) { ... } );
Make sure to keep the `action: 'accept'` and `action: 'reject'` (the dialog uses this to make the two buttons do things), the other pieces can be changed.
-- Bartosz Dziewoński
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org