Button not working
Application Type
Mobile
Service Studio Version
11.14.5 (Build 57418)

Hi! I'm a beginner in app making, but I'm making an app for a project of mine. When I double-click buttons in my Service Studios, the button opens up a screen I linked it to. But when I load the app onto my phone or even run it in the browser, it did nothing. How do I fix this?


Attached here is the oml to my app.

PETTRACK.oml

Solution

Hi Solehan Zakaria,

First time, your application opens HomeScreen which is accessible to Anonymous and Registered role both.  But your PetReg screen is only accessible to Registered role that is why when you are clicking on the Add Pet button, it is giving 'Registered role required' error.

To solve this issue either change the access of PetReg screen to Anonymous role as well like below

 

or you can add some logic to handle the error in OnException handler as attached OML.


Thanks
Pankaj

PETTRACK.oml

Hi Pankaj, sorry for the late reply, and thank you so much for your reply. Your solution fixed the problem that I've been facing for 4 days. Think you so much!

Hi Solehan,

which button doesn't work?

Pretty much all buttons (Add pet button on the floating button, and about button in the side menu)

mvp_badge
MVP

Hi Solehan,

I guess you are referring to the HomeScreen > Add Pet button defined inside the FloatingActions. The observed issue is related to the defined AddPet Button onClick event handler (client action).

Observation:

  • For the AddPet button, you have defined the OnClick Event handler twice, which is not required.
  • Reason: The defined AddPet button second OnClick event handler is mapped with a Screen action that calls itself (without any conditional flow break), leading to an infinite call that exceeds the call stack.


Solution:

I suggest defining only the first click event handler under the events section for your use case. Note that while defining a recursive call logic, never miss to define a stopping condition.

Refer to the attached .oml file.

I hope this helps you!


Kind regards,

Benjith Sam

PETTRACK.oml

Thank you for the reply, I did some editing and the Add Pet button doesn't redirect me to the PetReg screen. It crashes the app instead, shown in the video in the following link:
https://youtu.be/ZZ5qXw1WLL8

mvp_badge
MVP

Hi Solehan, 

If you can share the oml with the latest code changes, we can help you better or else you can understand the occured issue my monitoring the error logs from the service center.


Kind regards,

Benjith Sam

Solution

Hi Solehan Zakaria,

First time, your application opens HomeScreen which is accessible to Anonymous and Registered role both.  But your PetReg screen is only accessible to Registered role that is why when you are clicking on the Add Pet button, it is giving 'Registered role required' error.

To solve this issue either change the access of PetReg screen to Anonymous role as well like below

 

or you can add some logic to handle the error in OnException handler as attached OML.


Thanks
Pankaj

PETTRACK.oml

Hi Pankaj, sorry for the late reply, and thank you so much for your reply. Your solution fixed the problem that I've been facing for 4 days. Think you so much!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.