Issue
I am using WaveMaker 6.3.2GA.
There is a UserName and Password Textbox and then Sign in button.
I've created Java Service and Service Variable for it.
Bind its properties with related textboxes.
On Button's click event attached service variable and
on service variable's onSuccess
event, I've called Javascript function which navigate to the admin page if user is admin.
But its not working on button's click event, it stay on home page only. I've imported project into Eclipse. I am not getting where's the mistake? Did I forget to set somewhere? If import the project into Eclipse then is there anything which we have to set in eclipse? Can anyone please help me here?
Below is the code of Javascript function which I wrote in WaveMaker:
loginServiceSuccess: function(inSender, inDeprecated) {
try {
console.info( this.LoginServiceVar.data.role);
if("admin" == this.LoginServiceVar.data.role){
//this.goToAdminHomepage.update();
this.goToAdminHome.update();
}else if("employee" == this.LoginServiceVar.data.role){
this.goToemp.update();
}
app.userId = this.LoginServiceVar.data.id;
console.info("logged in user" + app.userId);
} catch(e) {
console.error('ERROR IN loginServiceSuccess: ' + e);
}
}
Solution
Are you using Firebug(or equivalent) in your browser to confirm that value of "this.LoginServiceVar.data.role" is not null? I would ask the same regarding your Java service - are you stepping through the code with the Eclipse debugger? If not, a quick way to check if there is an error in your Java service is to check the wm.log. This file is located in the "logs" dir at the same subdir level as your Wavemaker/projects dir.
Hope that helps.
Answered By - Curtis
Answer Checked By - Terry (JavaFixing Volunteer)