Posted on 30/01/2019 09:27:23
Hi Jens
Yes, in various ways.
First of all the forms has a template option - you can use your own. Form templates can be rendered in ways - one is a loop of fields making the template dynamic, the other is adding each field manually to the template as they are created in the module.
So something like this:
@foreach (LoopItem field in GetLoop("Fields"))
{
int fieldId = field.GetInteger("Field.ID");
string fieldHtmlId = field.GetString("Field.HtmlId");
string fieldName = field.GetString("Field.Name");
string fieldSystemname = field.GetString("Field.SystemName");
string fieldControl = field.GetString("Field.Control");
string fieldDescription = field.GetString("Field.Description");
string fieldType = field.GetString("Field.Type");
bool fieldIsButton = field.GetBoolean("Field.IsButton");
bool fieldIsOther = field.GetBoolean("Field.IsOther");
bool fieldRequired = field.GetBoolean("Field.Required");
if (fieldName == "MyDropdown" && fieldType == "Select")
{
<select id="@fieldHtmlId" name="@fieldSystemname">
@foreach (LoopItem option in GetLoop("Options"))
{
string optionValue = option.GetString("Option.Value");
string price = string.Empty;
if (optionValue == "Stor pakke")
{
Pageview.AreaSettings.GetString("YourItemSystemNameFor_Lille_pakke_pris");
}
<option value="@optionValue">@option.GetString("Option.Text") @price</option>
}
</select>
}
//More logic
}