You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create a form programmatically as the form fields are being saved in a database so the users can create their own forms with their own data. This part I have working and the forms are displayed exactly as they should.
The only issue is that when the "NotOptional" value is set to true, there is no validation done on the form when it is submitted.
Below is an example using the demo "Programmatically created form" data and when it is submitted, it submits and does not show that the fields are required or cancel the submission like it does on the first demo called "Auto Complete" here: http://formfactory.apphb.com/
Any idea why this is happening and not validating?
<form action="/home/save" method="POST"> @{ var formModel = new[] { new PropertyVm(typeof(string), "username") { DisplayName = "Username", NotOptional = true, }, new PropertyVm(typeof(string), "password") { DisplayName = "Password", NotOptional = true, GetCustomAttributes = () => new object[] {new PasswordAttribute()} }, new PropertyVm(typeof(string), "os") { DisplayName = "Operating System", NotOptional = true, Choices = new List<string>() {"OSX", "IOS", "Windows", "Android"}, Value = "Windows", //Preselect windows GetCustomAttributes = () => new object[] {new RadioAttribute()}, }, new PropertyVm(typeof(string) , "textmessage") { DisplayName = "Type a message:", NotOptional =false, GetCustomAttributes = () => new object[] { new MultilineTextAttribute(), new DisplayAttribute(){Prompt = "placeholder??"}, new SuggestionsUrlAttribute( "/home/CountrySuggestions" ) }, }, }; @formModel.Render( Html ) } <input type="submit" value="submit" /> </form>
The text was updated successfully, but these errors were encountered:
Hi!
I am trying to create a form programmatically as the form fields are being saved in a database so the users can create their own forms with their own data. This part I have working and the forms are displayed exactly as they should.
The only issue is that when the "NotOptional" value is set to true, there is no validation done on the form when it is submitted.
Below is an example using the demo "Programmatically created form" data and when it is submitted, it submits and does not show that the fields are required or cancel the submission like it does on the first demo called "Auto Complete" here: http://formfactory.apphb.com/
Any idea why this is happening and not validating?
<form action="/home/save" method="POST"> @{ var formModel = new[] { new PropertyVm(typeof(string), "username") { DisplayName = "Username", NotOptional = true, }, new PropertyVm(typeof(string), "password") { DisplayName = "Password", NotOptional = true, GetCustomAttributes = () => new object[] {new PasswordAttribute()} }, new PropertyVm(typeof(string), "os") { DisplayName = "Operating System", NotOptional = true, Choices = new List<string>() {"OSX", "IOS", "Windows", "Android"}, Value = "Windows", //Preselect windows GetCustomAttributes = () => new object[] {new RadioAttribute()}, }, new PropertyVm(typeof(string) , "textmessage") { DisplayName = "Type a message:", NotOptional =false, GetCustomAttributes = () => new object[] { new MultilineTextAttribute(), new DisplayAttribute(){Prompt = "placeholder??"}, new SuggestionsUrlAttribute( "/home/CountrySuggestions" ) }, }, }; @formModel.Render( Html ) } <input type="submit" value="submit" /> </form>
The text was updated successfully, but these errors were encountered: