1

I am using Formflow to generated the necessary questions in order to get all data from the user. Since I am supporting multiple languages, I cannot just use the attributes. So I read up about it and noticed RView can be used to generated resource files. However, as I already have my resource files split up and ordered, I am trying to reuse those.

Using the FieldReflector, I can do this quite easily

form.Field(new FieldReflector<HolidayPlanningFlowForm>(nameof(StartDate),true) .SetType(typeof(string)) .SetFieldDescription(Resources.HolidayResources.Planning_FlowStartDate_Describe) .SetPrompt(new PromptAttribute(Resources.HolidayResources.Planning_FlowStartDate_Prompt))); 

So, nice. But I cannot figure out where to defined my templates for TemplateUsage.NotUnderstood or TemplateUsage.DateTimeHelp for example. In the reference, there is a method available on Field, ReplaceTemplate(), but this reflector returns an IField and can't figure out how to get this to work.

Anyone experience in this with the best option (I really don't want to use RView ;))

1 Answer 1

1

I think the issue here is .SetType(typeof(string)) If that is changed to typeof(DateTime) then .ReplaceTemplate() will function as expected:

public static IForm<TermFormFlow> BuildForm() { return new FormBuilder<TermFormFlow>() .Message("Bla Bla") .Field(new FieldReflector<TermFormFlow>(nameof(DateOfBirth), true) .ReplaceTemplate(new TemplateAttribute(TemplateUsage.NotUnderstood, "I do not understand \"{0}\".", "Try again, I don't get \"{0}\".")) .ReplaceTemplate(new TemplateAttribute(TemplateUsage.DateTimeHelp, "This field should be in the format '01/01/2018'", "Please enter a date or time")) .SetType(typeof(DateTime)) .SetFieldDescription(Resources.HolidayResources.Planning_FlowStartDate_Describe) .SetPrompt(new PromptAttribute(Resources.HolidayResources.Planning_FlowStartDate_Prompt))) .AddRemainingFields() .Build(); } 
Sign up to request clarification or add additional context in comments.

1 Comment

Well you were right as a 4-letter word I won't pronounce.Thank you for the quick response!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.