Form required fields different for each country

Vote:
 

Hi, I'm working on an Episerver CMS 8 website. I need some design for my forms, so I've decided not to use the defaul Xforms, but:

1) create a form *.cshtml myself with the fields needed, applying needed design

2) create an xform with same fields

3) In a form controller, asign the form fields to xform fields, and save the xform.

This is working well right now.

Now the new requirement:

Is it possible that some fields are required for one country/language, but no required for another country/language

Regards.

#141890
Nov 24, 2015 9:39
Vote:
 

Antonio,

If the need is to have data from all markets / languages be submitted to the same XForm, I think the best approach here would be to keep the XForms field requirements very limited, and then enforce your requirements in the MVC Validation.

You could consider adding something like Fluent Validation to your project to allow you to more easily organize and add complex validation to a form model. You could then somehow link that validation up to an Episerver field if you needed to dynamically manage which languages require certain data.

I'd also encourage you to check out the new Episerver Forms feature - which might more easily be able to suit the requirement if you are on the latest version.

Hope this helps,

/Matt

#142137
Dec 01, 2015 23:40
Vote:
 

Thank you Matthew!!!

#142138
Dec 02, 2015 9:21
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.