87
Views
9
Comments
Solved
Putting an "onclick" handler to my button group options makes them unclickable?
Question

Without an onclick event, I can click the buttons and they change colors to indicate which one is currently pressed. With the onclick event (I have the onclick event assigning a value to a client variable), they stop being highlighted. This is weird because I used buttongroups with onclick events before (for example to move to a different screen), and they worked fine and also highlighted the choice.

I'm working with reactive web app.

Any ideas?

Rank: #1583
Solution

Akis M wrote:

Shailesh wrote:

Akis M wrote:

Shailesh wrote:

Akis M wrote:

Without an onclick event, I can click the buttons and they change colors to indicate which one is currently pressed. With the onclick event (I have the onclick event assigning a value to a client variable), they stop being highlighted. This is weird because I used buttongroups with onclick events before (for example to move to a different screen), and they worked fine and also highlighted the choice.

I'm working with reactive web app.

Any ideas?

Hi Akis,

Can I see the oml to check what problem might be there since it works fine for button group but there must be something that you have missed or else, please upload oml so that I can see where might be the mistake.

Thankyou


Hi, unfortunately I can't export OML and share because it is an enterprise level app and thus confidential. Another clue that might help:


When I click on the buttons that are "not working", the action that assigns value to my client variable actually works. I checked my next screen where the values are displayed, and they correspond to the buttons clicked. The issue is that the button click does not become highlighted like all other button groups.



That's alright, your action works but colors of button did not change, so did you change any CSS applied on the buttons and the button group, because it's the CSS that makes the color changes and these kind of features. Please check the styles applied on your button and the button group.


I thought of that as well, I didn't change CSS at all, but I also deleted my button group and started it from scratch just in case I changed CSS accidentally and didn't remember. Same issue. Without my onclick events the buttons change colors, as soon as I add onclick event to a button, it stops getting highlighted when I click it.


I might got where you're stuck at, you need to set onclick action on button group or button?

if you want something to happen on click of a button in a button group then set onclick action on button group widget and it will work.

You might be setting onclick action on the button group items i. e. buttons and that is not a good approach since then you have to set on click on all of the buttons. Let me know if that works for you.

Thankyou


Rank: #1583

Akis M wrote:

Without an onclick event, I can click the buttons and they change colors to indicate which one is currently pressed. With the onclick event (I have the onclick event assigning a value to a client variable), they stop being highlighted. This is weird because I used buttongroups with onclick events before (for example to move to a different screen), and they worked fine and also highlighted the choice.

I'm working with reactive web app.

Any ideas?

Hi Akis,

Can I see the oml to check what problem might be there since it works fine for button group but there must be something that you have missed or else, please upload oml so that I can see where might be the mistake.

Thankyou


mvp_badge
MVP
Rank: #112

Akis M wrote:

Without an onclick event, I can click the buttons and they change colors to indicate which one is currently pressed. With the onclick event (I have the onclick event assigning a value to a client variable), they stop being highlighted. This is weird because I used buttongroups with onclick events before (for example to move to a different screen), and they worked fine and also highlighted the choice.

I'm working with reactive web app.

Any ideas?

Hi Akis,

I don't think onchange is creating issue because it always works for me. This issue may occure if you are using same variable (which you are using for button group value) with other element also on the screen.


My solution was adding onclick listeners to each button of the button group using Javascript, on render.

I needed hide a button when one of the buttongroup is click, but because I had the same problem that the buttongroup unclickable when I implemented with on click event, I finally solved used javascript function on render.