18
Views
3
Comments
Help  eventListener in the buttons
Service Studio Version
11.54.10 (Build 62419)

Hello group I'm trying to create a calculator in outsystems I used a run client action with javascript and linked it to each button but the eventListenner is acting as a counter and duplicating the clicked items.ex. 7 88 999 4444Does anyone have any suggestions?

Calc.oml
2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

Why would you want to build it. 

You can download it from the Forge!

https://www.outsystems.com/forge/component-overview/11081/calculator

Regards,

Daniel

UserImage.jpg
Kay Lun

Hi Fernando Fernandes,

Not sure why you would like to create a calculator, but I assume you're trying to understand how Javascript works in OS.

The problem is came from your JS script, when you try to get the data by using the innerText, it will return a string instead of a number, and in JS sum 1+1 is different with "1" + "1", and here's why your code didn't work as what you expected. 

You could try to find how to convert the string into a number in JS, and I'm sure you will get what you want with that :)

Beside, I think the calculator could be done inside OS without JS implementation, you just have to know how to use the action and variable in OS.

Hope this help.

Cheers.

KL

2024-09-12 02-43-38
Deepsagar Dubey

Hi @Fernando Fernandes 

I didn't opened your OML but may i know why you are using JavaScript here if we can handle it by Outsystems itself,

Even if you tried to to it by Outsystems then it'll be more easier for you.

I hope it'll help you.

Thanks
Deep

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