92
Views
11
Comments
Solved
How to make a radio Button checked by default when the App first launched
Question

Hi, 

I'm trying to implement a radio Button, this radio button is filled from a static Entity.

I an see the values, but no one of then is checked by default.

How can I make one of them checked when the app is first loaded.

Thanks in advanced

2023-04-16 15-25-31
Krishnanand Pathak
Solution
2023-04-16 15-25-31
Krishnanand Pathak
Solution

Hi,


Sharing the oml in which there is a radio button which is already at start that I have assigned at OnAfterFetch of aggregate

You can check the demo to see how it will work though below link.
https://personal-qmzjggmd.outsystemscloud.com/Com/Screen6?_ts=638182024362505493

Regards
Krishnanand Pathak


AlreadySelected.oml
2023-04-06 11-24-23
Paulo Zacarias

Hi, 

Can you confirm that you have assigned the correct value to the variable that is linked to the radio button?

Regards, 

PZ

UserImage.jpg
you asen

Yes

2023-04-16 15-25-31
Krishnanand Pathak


Hi,
You have to set default value to Profile.NotificationId variable

As shown below:


Regards
Krishnanand Pathak

UserImage.jpg
you asen

I Do not understand your solution, because I'm not using local variable, I'm initializing the SMS and the Email directly from the static entity:


2023-04-16 15-25-31
Krishnanand Pathak

Profile.NotificationId is the aggregate variable which holds the Static entity Id.
At on after fetch action of the aggregate assign Profile.NotificationId as shown below

Profile.NotificationId = Entities.Notification.Sms
or
Profile.NotificationId = Entities.Notification.Email

based on what you want to be already selected.

Because the Profile.NotificationId holds the value of radio button. If it has value
assigned it will already selected  at start.

2023-04-16 15-25-31
Krishnanand Pathak
Solution

Hi,


Sharing the oml in which there is a radio button which is already at start that I have assigned at OnAfterFetch of aggregate

You can check the demo to see how it will work though below link.
https://personal-qmzjggmd.outsystemscloud.com/Com/Screen6?_ts=638182024362505493

Regards
Krishnanand Pathak


AlreadySelected.oml
UserImage.jpg
you asen

thanks a lot, it is working now, I have just one more question please.

when I save the form, the value of the radio button is going to be saved at Profile.NotificationId ? or where ?

2023-04-16 15-25-31
Krishnanand Pathak
Solution
2023-10-21 19-42-11
Tousif Khan
Champion

Hello

You can assign the value to Profile.NotificationId on the after fetch event client action of your  profile aggregate

You can check like

If Profile.NotificationId   then = Entities.Notification.Email



Sample 

Thanks

Tousif Khan

Sample_OS.oml
UserImage.jpg
you asen

But my form is to save data into the database, that why I put Profile.NotificationId

Profile is the entity

NotificationId is the field where I save the value.


2024-03-11 09-26-19
Rahul Shrivastava

Hello,

you can bind any type of variable (add default value) with radio button group, but make sure the radio button which you want to set default true the value should be match with the variable's default value.

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