简体   繁体   中英

JavaScript function on button's click event is not working in WaveMaker

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); 
}         
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM