Closed ivansoriabia closed 5 years ago
So you are creating PropertyVms programatically? You can add your own attributes: e.g.
new PropertyVm(typeof(DateTime), "StartDate")
{
DisplayName = "Start Date",
Value = startDate
GetCustomAttributes = () => new object[] {new DisplayFormatAttribute {DataFormatString = "dd/MM/yyyy"}]
},
So you can add a RequiredAttribute into the GetCustomAttributes Func
I think to fix the optional message you'll have to either
2, or take a fork, and modify mine to work of a resx file, and send me a Pull Request
This PR already added a resx file
What I need to do to add Spanish translation to FormFactory?
Being a Brit, I'm terrible at i18n, but have a read of this.
As I recall
add keys to the resx files for the text you want translated see Resources.resx and Resources.es.resx - VS should give you a custom editor for doing this.
use the resource in the code e.g. CompareAttribute.cs
get your app to set the correct CurrentCulture
Does creating a new resource file (e.g. Resource.fr.resx) in our projects work? or do we have to clone FormFactory and create the new language resource files in it for it to work?
I'm not sure, I'm not a big resx user.
Hello Harry!
I'm finishing my project with FormFactory and I'm trying to validate the data from my inputs. In ASP .NET Core you can set it like this:
But I haven't found any way to set it when I create my PropertyVms, so there is way to set my custom error message?
Another thing that I would like to change is the language that the NotOptional / Optional Label is shown. I would like to set it in Spanish.
Thank You!