Radio button list

Radio button list

  

Hi,

I need to have a radio button list which is directly read out from entity.

Does anyone has idea how to do this?

Help !! 

Hello Johnson...

I think a litle more context is required...

You want to show a list of radio buttons, where the user will be able to select a single option?
If so, just put in your list a label to show and a value (can be the id), use a List Records, and associate each Radio Button value with the Current value of the list (ID or other field), than create a local variable of the same type of the value and associate this variable to the variable parameter of the radio button (this one will receive the value selected by the user).

Is this what you want do do?

What is your requirement? Maybe there are better ways to accomplish them...

Cheers.

Hi Eduardo,

It is exactly like what you said.A list of radio button and user only can choose one of them.

Do you have some sample code/screen to show on how to do that?

Solution

Hi Johnson.

Don't have. But it is easy.

1. Put your list records in the screen. With source to your source (list of an aggregate, for example)
2. Add the Radio Button and an expression for label. Set the VALUE of the radio button to the id of the record being selected (ex: ListRecord1.list.Current.record.id).
3. Set the VARIABLE associated with the radio button to a local variable in the page.

WHen the user choses an option, this variable will be updated.

Cheers.

Solution

Thanks Eduardo

Hi Eduardo,

I have 1 more question to ask here. I learn that the last option is always selected.

Do you have any idea to remove it from being always selected?

Below is how is variable declared and assigned to the Radio button.


Hi.

Remember that the valuesbofbeach radio buttons do not change over time. What changes is the value that you put in the variable, which comes from the 

If you use True/false as the values of the radio buttons, a radio button with value false, if selected will always put false in variable.

Usually you want to put different values in each one, so that you can identify which item was selected. If the list comes from an aggregate or sql, use the id of the record. otherwise you need to use a field that is unique (no repetition), or even create a field where you pit a counter (starting in 0), to find the index of the item.

If the variable, at the end of the preparation, has a value that exists in one of the radio buttons, this radio button will be selected.

Cheers

Thanks Eduardo