Does anyone know where I can find the names or Ids of the built in data field types in UF?
I'm trying to output different things depending on the type of field; I can do this: @if (f.FieldType.Name == "Checkbox") but only because I guessed what the name was
The Umbraco Forms fields are output using the partial views in Views\Partials\Forms\FieldTypes. These use the guid as the field Id and Name. There is a view for each field type.
The form itself is rendered via Views\Partials\Forms\Form.cshtml which uses FieldViewResolver.GetFieldView to choose which of the partial views to render.
This is where I am looking, in the Form.cshtml. I can do this for example; @if (f.FieldType.Name == "Checkbox") { do something }
What i can't figure out is where i get this list of "Names" from, eg this condition effects the field that uses the partial: FieldType.CheckBox.cshtml, what 'Name' would i use to put a condition on the field that uses: FieldType.DatePicker.cshtml for example?
Umbraco Forms FieldType Name or ID
Hi,
Does anyone know where I can find the names or Ids of the built in data field types in UF?
I'm trying to output different things depending on the type of field; I can do this:
@if (f.FieldType.Name == "Checkbox")
but only because I guessed what the name wasThanks Kerri
Hi Kerri,
The Umbraco Forms fields are output using the partial views in Views\Partials\Forms\FieldTypes. These use the guid as the field Id and Name. There is a view for each field type.
The form itself is rendered via Views\Partials\Forms\Form.cshtml which uses FieldViewResolver.GetFieldView to choose which of the partial views to render.
Tim
Hi Tim,
Thanks for the reply :)
This is where I am looking, in the Form.cshtml. I can do this for example;
@if (f.FieldType.Name == "Checkbox") { do something }
What i can't figure out is where i get this list of "Names" from, eg this condition effects the field that uses the partial: FieldType.CheckBox.cshtml, what 'Name' would i use to put a condition on the field that uses: FieldType.DatePicker.cshtml for example?
Does that make sense?
Thanks Kerri
Kerri,
The names available are those that you see in the form designer when you choose the answer type, for example:
Each of these will correspond to one of the FieldType partial views.
I have done something very similar in my forms. If the field type is a Checkbox then I set an additional class at the outer element.
Tim
Thanks Tim, Easy if you know where to look! :)
is working on a reply...