cancel
Showing results for 
Search instead for 
Did you mean: 

Radiobuttons

Former Member
0 Kudos

Hello everyone,

I'm having some trouble finding a good example to show me how to use a simple radiobutton with only two choices ("yes" or "no") and how to bind that to a specific boolean variable in other context. Can anyone point me in the right direction ?

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Nuno,

Try this:

1. Create attribute of type boolean.

2. Create RadioButtonGroupByKey and bind selectedKey to this attribute

3. Add the following to wdDoInit of controller:


final ISimpleValueSet svs = wdContext
  .nodeMyNode().getNodeInfo().getAttribute("MyBooleanAttr")
    .getSimpleType().getSVServices().getValues();
svs.clear();
svs.put(Boolean.FALSE, "No");
svs.put(Boolean.TRUE, "Yes");

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

ooopss.....

Code must be:


IModifiableSimpleValueSet svs = wdContext
  .nodeMyNode().getNodeInfo().getAttribute("MyBooleanAttr")
    .getModifiableSimpleType().getSVServices()
      .getModifiableSimpleValueSet();
svs.clear();
svs.put(Boolean.FALSE, "No");
svs.put(Boolean.TRUE, "Yes");

VS

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Valery

The code is OK, but in case of internationalization of Yes/No words it's better to create new Simple type with Integer as built-in-type having enumeration with two values:

1 - Yes

2 - No

Attribute "MyBooleanAttr" must be of the simple type then.

PS: the attribute will be as Integer, not Boolean, I'm sorry for confusing

BR

Sergei

Message was edited by: Siarhei Pisarenka

Former Member
0 Kudos

Siarhei,

I know this option.

However, some NW IDE incorrectly handles non-string enumeration after they was created. I.e. first time when you edit enumeration everythng is ok, next edit removes enumeration texts.

VS

Former Member
0 Kudos

Thank you everyone for your fast answers. Problem solved 😄

Answers (1)

Answers (1)

Former Member
0 Kudos

Why not simply use a CheckBox in this case?

Armin

Former Member
0 Kudos

<i>Why not simply use a CheckBox in this case?</i>

Ever try to tell this to wireframe designers?

VS