Is there a way to set the default choice button on a dialog?
I have this code:
var $yes = globals.sys_i18n_getMessage({key: "i18n:btn.yes"});
var $no = globals.sys_i18n_getMessage({key: "i18n:btn.no"});
var $tit = globals.sys_i18n_getMessage({key: "i18n:tit.herstellen"});
var $msg = globals.sys_i18n_getMessage({key: "i18n:msg.rapport_herstellen"});
var $res_dialog = plugins.dialogs.showWarningDialog($tit, $msg, $yes, $no);
Now the $yes button is selected to be the default button. But if I want the $no button to be selected by default without changing the position of the buttons, how can I do this?
Peter de Groot:
Put $no before $yes
I don’t want to change the possition of the buttons. I always want to start with yes and then comes no.
I know other programming languages have options to set the default button. Like:
MESSAGE( text [,caption] [,icon] [,buttons] [,default] [,style] )
Hi,
$no_element.requestFocus() in the onShow-event of the form.
Regards,
lwjwillemsen:
Hi,
$no_element.requestFocus() in the onShow-event of the form.
Regards,
This won’t work when using the:
plugins.dialogs.showQuestionDialog
or
plugins.dialogs.showWarningDialog
There is no form or element to set the focus.
thats currently not possible, i think the Dialog plugin (DialogProvider class) need to be changed:
now always the first option is set to be the default one.
You could quickly patch it yourself and/or create a case for this.
MichelvGent:
lwjwillemsen:
Hi,
$no_element.requestFocus() in the onShow-event of the form.
Regards,
This won’t work when using the:
plugins.dialogs.showQuestionDialog
or
plugins.dialogs.showWarningDialog
There is no form or element to set the focus.
Sorry, we use our own solutionModel- and form-based dialog module.
Regards,