Hi ,
I am struggling with the next script, with a sample of some Dialogs routines.
Function ‘canGotoNextPage ‘ doesn’t work correct anymore when method 'setActiveWizardPages' is used in the script.
In next script the same dialog is called twice: the first time without use of method setActiveWizardPages, the second time with it.
The first time function ‘.canGotoNextPage’ is correct, the second time it isn’t.
Does anyone know what I'm doing wrong?
Many thanks in advance.
Best regards,
Ariene Kroeze
This is my code:
Dialogs.MsgBox("Dialog without setActiveWizardPages, runs correct") Dialogs.showDialog(new my_dialog(false), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" ) Dialogs.MsgBox("Dialog with setActiveWizardPages, doesn't run correct") Dialogs.showDialog(new my_dialog(true), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" ) function my_dialog(bDoActiveWizardPages){ this.getPages = function(){ var Template0 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 0"); Template0.Text (10,10,400,20, "Text 0") var Template1 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 1"); Template1.Text (10,10,400,20, "Next textbox must have value") Template1.TextBox (10,30,400,20, "txtBox1",0) var Template2 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 2"); Template2.Text (10,10,400,20, "Text 2") return [Template0, Template1, Template2] } this.init = function(){ if (bDoActiveWizardPages){ this.dialog.setActiveWizardPages([1,2]); // <<<< this is the trouble making call } } this.isInValidState = function (iPageNumber){ return true } this.canFinish = function (iPageNumber){ return true } this.canGotoNextPage = function (iPageNumber){ var lBool = true switch(iPageNumber){ case 1: var sName = this.dialog.getDialogElement("txtBox1").getText() if (sName==""){ lBool = false } break } return lBool } }
Hi Ariane,
ahm, this is interesting. If you don't use the first dialog, it works for me (7.26)... So I have just commented out the first lines :-)
BR Robert
//Dialogs.MsgBox("Dialog without setActiveWizardPages, runs correct")
//Dialogs.showDialog(new my_dialog(false), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" )
//Dialogs.MsgBox("Dialog with setActiveWizardPages, doesn't run correct")
Dialogs.showDialog(new my_dialog(true), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" )
function my_dialog(bDoActiveWizardPages){
this.getPages = function(){
var Template0 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 0");
Template0.Text (10,10,400,20, "Text 0")
var Template1 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 1");
Template1.Text (10,10,400,20, "Next textbox must have value")
Template1.TextBox (10,30,400,20, "txtBox1",0)
var Template2 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 2");
Template2.Text (10,10,400,20, "Text 2")
return [Template0, Template1, Template2]
}
this.init = function(){
if (bDoActiveWizardPages){
this.dialog.setActiveWizardPages([1,2]); // <<<< this is the trouble making call
}
}
this.isInValidState = function (iPageNumber){
return true
}
this.canFinish = function (iPageNumber){
return true
}
this.canGotoNextPage = function (iPageNumber){
var lBool = true
switch(iPageNumber){
case 1:
var sName = this.dialog.getDialogElement("txtBox1").getText()
if (sName==""){
lBool = false
}
break
}
return lBool
}
}
Hi Robert,
I'm afraid that that is not the problem (or the solution).
I have updated the call back function 'canGotoNextPage' to the code below (so now it doesn't not depend on (renumbered?) page numbers). But unfortunately still the same result.
Cheers, Ariene
this.canGotoNextPage = function (iPageNumber){ var lBool = true var oPage = this.dialog.getPage(iPageNumber) var sPageTitle = oPage.getPageTitle() if (sPageTitle == "Dialog 1"){ var oElement = oPage.getDialogElement("txtBox1") var sName = oElement.getText() if (sName==""){ lBool = false } } return lBool }
Hi Ariane,
I have tried another few things and here are my findings (sadly only valid for 9.6 at the moment, but perhaps you can validate this for 9.8).
1) When I start it with two dialogs and your new lines, it does not work correctly
2) When I start with the code below (meaning only one call of the dialog) and I leave the text box, then enter something in the text box , it does not work
3) When I start with the code below and I directly enter something in the textbox => then it works for me in 9.6
//Dialogs.showDialog(new my_dialog(false), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" )
Dialogs.showDialog(new my_dialog(true), Constants.DIALOG_TYPE_WIZARD_NONLINEAR, "Title" )
function my_dialog(bDoActiveWizardPages){
this.getPages = function(){
var Template0 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 0");
Template0.Text (10,10,400,20, "Text 0")
var Template1 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 1");
Template1.Text (10,10,400,20, "Next textbox must have value")
Template1.TextBox (10,30,400,20, "txtBox1",0)
var Template2 = Dialogs.createNewDialogTemplate(520, 300, "Dialog 2");
Template2.Text (10,10,400,20, "Text 2")
return [Template0, Template1, Template2]
}
this.init = function(){
if (bDoActiveWizardPages){
this.dialog.setActiveWizardPages([1,2]); // <<<< this is the trouble making call
}
}
this.isInValidState = function (iPageNumber){
return true
}
this.canFinish = function (iPageNumber){
return true
}
this.canGotoNextPage = function (iPageNumber){
var lBool = true
var oPage = this.dialog.getPage(iPageNumber)
var sPageTitle = oPage.getPageTitle()
if (sPageTitle == "Dialog 1"){
var oElement = oPage.getDialogElement("txtBox1")
var sName = oElement.getText()
if (sName==""){
lBool = false
}
}
return lBool
}
}
Thank you Robert, for all your efforts.
I'm afraid that I have found a bug in version 98.2, I've tried the same script as yours, and no, it doesn't work.
Besides, I am focused now on function 'canGotoNextPage', but the bug caused a lot of other problems as well.
I hope that I am wrong.
Cheers, Ariene