cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Radio button

jensc
17-Peridot

Radio button

Hello,

 

I am trying to use two radio button widgets in a mashup on 9.3.5.

jensc_0-1680081588221.png

I have set them to the same Radiogroup:

jensc_1-1680081671646.png

And I feel like I am missing something super obvious, but shouldn't I be able to know which of the buttons in the group I have selected? Otherwise I'm not sure I see the reason to group them...

 

For now I'll just use the "Generic Radio Button" widget instead.

 

Thanks,

Jens

1 ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To:jensc)

*Explanation*

 

It seems like there are different use cases for each type of radio button widget.

 

For my particular use case it is simpler to just use the Generic Radio Button widget as I would like to use it to quickly select one or the other option in it.

For other use cases such as somewhere you would like to have a multi select (similar to check boxes) but want to limit the user in only selecting one option, then the Themable Radio Button widget might be better.

 

I hope this explanation covers most situations in case someone else stumbles upon this post.

Also, have a look at @nitinsriv answer as well.

 

Thanks,

Jens

View solution in original post

5 REPLIES 5
nitinsriv
7-Bedrock
(To:jensc)

In case you are trying to achieve something like below:

 

nitinsriv_0-1680096394546.png

red marked is radio group, while the blue one is generic radio button.

Then I have a binding to trigger service which just displays option selected as a basic example.

But hopefully this can be extended to fit your needs with some tweaking.

nitinsriv_1-1680096490550.png

nitinsriv_2-1680096575605.png

 

 

 

 

jensc
17-Peridot
(To:nitinsriv)

Hello,

 

I think I see what you have done.

Basically if the first radio button is not "true" then the second radio button would be (if you have set one of the buttons to true by default).

This approach does work, I was even thinking of having both radio buttons states passed into an expression and do a check like:

 

if (button1 && !button2) {
  output = 'button1 selected';
else if (!button1 && button2) {
  output = 'button2 selected';
}

But this would get really annoying if I need to add more buttons in the future.

 

I suppose if I don't want to use the Generic Radio Button widget I'd have to build my own widget or wait for an update of the regular "Radio button" widget.

 

Thanks,

Jens

nmutter
14-Alexandrite
(To:jensc)

The radio group only "makes sure" that only one is active. To find out which one you are on the right track I think.

 

As an alternative you can use the "ButtonBar" which may be easier to use but needs a StateDefinition. E.g. with alert priority State definition:

nmutter_0-1680168989402.png

 

Hi Jens,

 

This is also true if you need to set the values on loading your mashup.  Each button has to be set individually and it does get more complicated/annoying depending on the amount of buttons in the group.

 

Travis

jensc
17-Peridot
(To:jensc)

*Explanation*

 

It seems like there are different use cases for each type of radio button widget.

 

For my particular use case it is simpler to just use the Generic Radio Button widget as I would like to use it to quickly select one or the other option in it.

For other use cases such as somewhere you would like to have a multi select (similar to check boxes) but want to limit the user in only selecting one option, then the Themable Radio Button widget might be better.

 

I hope this explanation covers most situations in case someone else stumbles upon this post.

Also, have a look at @nitinsriv answer as well.

 

Thanks,

Jens

Top Tags