I have a form where I want to use radio buttons to represent the item value, but I want the label of the radio buttons to be something different than the value. For example, I have a name and I want to distinguish that name between a type of Person or Company, but the data value representing the name type is numeric.
I can setup the form like this:
<form id="myForm"></form>
<script>
$("#myForm").kendoForm({
formData: {
ID: 1,
Name: "John Doe",
Type: 1 // 1 = Person, 2 = Company
},
items: [{
field: "Name",
validation: { required: true }
}, {
field: "Type",
editor:"RadioGroup",
editorOptions: {
layout: "horizontal",
items: [1, 2],
select:function(e){
// Do something here?
}
},
}]
});
</script>
Using Items: [1, 2] does work, but I don't want to show 1 and 2 on the radio buttons. I want to show Person and Company. How do I achieve that? Can I set Items: ["Person", "Company"] and then do something in the select function? If so, what needs to be done to set the model data correctly?
Please note that in my actual code, I am using setOptions for the model data, and not formData.
Thanks, Bob
I have also found that the required message does not work with the RadioGroup.