Try our conversational search powered by Generative AI!

What Block Type property should I use for an interface that displays Yes/No radio buttons?

Vote:
 

The specs for a new block that I need to construct require a Yes/No radio button pair.  My initial thought was to make this a bool, but according to the link below the editing experience for the Boolean property type is a checkbox.

https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/8/Content/Properties/Property-types/built-in-property-types/

What is the correct procedure for creating the Model Block Type property and the corresponding partial view to display Yes/No radio buttons?  Thanks for your help.

#187569
Jan 26, 2018 19:35
Vote:
 

It sounds like you are collecting form data from the user, so I would consider using Episerver Forms. You can build a form in CMS Edit, add it to a ContentArea on the page, and with @Html.PropertyFor(x => x.MyContentArea), Episerver will render the form by itself (including any radiobuttons that you supply). On form submit, it will collect the form data and store it for you without having to write any code. 

#187572
Jan 27, 2018 15:41
Vote:
 

Usually the standard if you want to present different text options is a dropdown such as here http://joelabrahamsson.com/enum-properties-with-episerver/ or https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/8/Content/Properties/Property-types/Single-or-multiple-list-options/ but you might be able to change the ClientEditingClass to be a radio button control.

#187586
Jan 29, 2018 9:59
Vote:
 

Thank you. I was heading down the wrong path and should have been using EPiServer Forms.  Good call Drew.

#187730
Feb 01, 2018 15:08
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.