Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to make any one option is required

Avatar

Avatar
Validate 1
Level 2
santhosha583576
Level 2

Likes

0 likes

Total Posts

52 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 2
santhosha583576
Level 2

Likes

0 likes

Total Posts

52 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
santhosha583576
Level 2

07-12-2018

Hello everyone

We had a requirement of single radio button in our project so we created it.

And in the form we have a question and options for that question are 5 single radio buttons which are different from each other.

I know how to make a radio button required. But here we have a requirement where either of the 5 should be choosed or it should throw an error . How can i acheive it

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 3
lesutton1
Level 3

Likes

9 likes

Total Posts

47 posts

Correct Reply

14 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile

Avatar
Boost 5
Level 3
lesutton1
Level 3

Likes

9 likes

Total Posts

47 posts

Correct Reply

14 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile
lesutton1
Level 3

11-12-2018

If you have an Adaptive Form and you added a radio button, you should be only able to select one of the values. It looks like what you've done is create a table with individual check boxes inside each one of the cells. This makes them independent fields instead of a single field so you'd be able to select all of them. Check boxes can be selected individually, radio buttons are a group where only one is allowed.

If you want to use the same approach, on the commit event of each of your objects, you'll need to null out the other values. This would simulate a radio button. Note that the check boxes all hold separate values too - you have 5 field values instead of one value that equals the selected value. You could handle this with a hidden field.

Ideally you'd skip the table approach and use text and a radio button and use CSS to get the look and feel you're going for. If you try to show this on a mobile device it won't make any sense to the end user.

Answers (6)

Answers (6)

Avatar

Avatar
Validate 1
Level 10
Mayank_Gandhi
Level 10

Likes

278 likes

Total Posts

1,101 posts

Correct Reply

181 solutions
Top badges earned
Validate 1
Contributor 2
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 1
Level 10
Mayank_Gandhi
Level 10

Likes

278 likes

Total Posts

1,101 posts

Correct Reply

181 solutions
Top badges earned
Validate 1
Contributor 2
Ignite 5
Ignite 3
Ignite 10
View profile
Mayank_Gandhi
Level 10

12-12-2018

Santhosh,

What Lee mentioned would be an Ideal approach here for your use case else you will have to play a lot at scripting level. In case you want to customize the radio button here is one great blog written some time back:

CSS3 Radio Buttons in Adaptive Forms

Avatar

Avatar
Validate 1
Level 2
santhosha583576
Level 2

Likes

0 likes

Total Posts

52 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 2
santhosha583576
Level 2

Likes

0 likes

Total Posts

52 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
santhosha583576
Level 2

11-12-2018

We have a requirement where we need to use single radio buttons(which has one option) for options for a questionCapture.PNG

in a Table as shown above we have a question and 5 options and all of them are single radio buttons (independent) either any one of them should be choosed

Avatar

Avatar
Validate 1
Level 10
Mayank_Gandhi
Level 10

Likes

278 likes

Total Posts

1,101 posts

Correct Reply

181 solutions
Top badges earned
Validate 1
Contributor 2
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 1
Level 10
Mayank_Gandhi
Level 10

Likes

278 likes

Total Posts

1,101 posts

Correct Reply

181 solutions
Top badges earned
Validate 1
Contributor 2
Ignite 5
Ignite 3
Ignite 10
View profile
Mayank_Gandhi
Level 10

10-12-2018

Hi Santhosh,

Any particular reason for going with 5 single radio button instead of a Radio button group?

Avatar

Avatar
Validate 1
Level 3
GaneshM
Level 3

Likes

15 likes

Total Posts

49 posts

Correct Reply

9 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
GaneshM
Level 3

Likes

15 likes

Total Posts

49 posts

Correct Reply

9 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
GaneshM
Level 3

10-12-2018

You can achieve using RadioGroup,

FYI, RadioGroup — Granite UI 1.0 documentation

Thanks!

Avatar

Avatar
Validate 1
Level 2
santhosha583576
Level 2

Likes

0 likes

Total Posts

52 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 2
santhosha583576
Level 2

Likes

0 likes

Total Posts

52 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
santhosha583576
Level 2

07-12-2018

I have a question in the Survey and the options for that question are 5 different single radio buttons . Either one of them should be choosed or it should throw an error that any one should be choosed

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

07-12-2018

You are not clear where the radio button is used:

1 - do you mean the radio button is used in a component dialog

2 - on an AEM component that is visiable in a web page

can you please clarify.