Hi
I'm building a custom HTML-template for a form using the Forms (for Datalists) (not sure about the translation), but I can't seem to get radio buttons and selects working correctly.
Because of the layout of the form I can't use the default output method <!--@Field.Control--> instead I want to use the following markup:
<label for="<!--@Field.Systemname-->"><!--@Field.Label--></label> <!--@LoopStart(FieldOptions)--> <label><input type="<!--@Field.Type.ToLower()-->" name="<!--@Field.Systemname-->" id="<!--@Field.Systemname--><!--@FieldOptions.LoopCounter-->" value="<!--@Field.Option.Value-->" /><!--@Field.Option.Text--></label> <!--@LoopEnd(FieldOptions)-->
The only thing missing though is a check for a preselected option, which I can't get working.
I'v tried the following if statements (using radio buttons as example):
<!--@If(Field.Value == Field.Option.Value)-->checked="checked"<!--@EndIf--> <!--@If(Field.Value != Field.Option.Value)--><!--@Else-->checked="checked"<!--@EndIf--> <!--@If(Field.Value <> Field.Option.Value)--><!--@Else-->checked="checked"<!--@EndIf--> <!--@If(Field.Value.Contains(Field.Option.Value))-->checked="checked"<!--@EndIf-->
Hope someone can help me!