Friday, February 13, 2009

Site Column with Radio Button choices

Scenario:
Creating a new site column with Radio button choices

Solution:
Declare a field tag with Type="Choice" and then using Format option u can display it as radio button.

Code:

<Field Type="Choice" DisplayName="Gender" 
Required="FALSE" Format="RadioButtons"
FillInChoice="FALSE"
ID="{8e153ed9-7960-409d-9a5c-7c3ccf204c5b}"
StaticName="Gender"
Name="Gender">
<Default>male</Default>
<CHOICES>
<CHOICE>male</CHOICE>
<CHOICE>female</CHOICE>
</CHOICES>
</Field>

2 comments:

Anonymous,  April 30, 2009 at 2:12 PM  

Do you know how to make the choice items display horizontally instead of one on top of the other?

Sandeep K Nahta April 30, 2009 at 5:18 PM  

I am not 100% sure but u can try Display Pattern node to make it horizontal , otherwise write your own Field Type ( Coding )