Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client validations not working when using PropertyVms to create Dynamic Forms. #95

Open
avani24897 opened this issue Mar 30, 2020 · 3 comments

Comments

@avani24897
Copy link

#73 (comment)

I've tried to add a RequiredAttribute into the GetCustomAttributes Func as you mentioned in the above issue. But somehow client validations not working in my case. If possible then give some suggestions on how to use RequiredAttribute into the GetCustomAttributes Func.

I'm using PropertyVms to create Dynamic Forms where my model is also dynamic to create PropertyVms. So I'm unable to use FormFactory.Attributes.

Thanks in advance.

@mcintyre321
Copy link
Owner

Could you post your code?

@avanisculptsoft
Copy link

avanisculptsoft commented Mar 31, 2020

Sorry for the delay and thanks for your quick response. Somehow I was misplaced my code for the required validation attribute. Now it's working properly for validations.

But I faced one more problem with nested forms creation in dynamic PropertyVms. It always gives
exception the same as #50 (comment).

My code is as below,

    var lasers = new[] {
            new PropertyVm(typeof(string) , "outer.Left")
            {
                DisplayName = "Left",
                NotOptional =true,
                GetCustomAttributes = () => new object[] { new DataTypeAttribute("TitleTol") }
            },
            new PropertyVm(typeof(string) , "outer.Right")
            {
                DisplayName = "Right",
                NotOptional =true,
                GetCustomAttributes = () => new object[] { new DataTypeAttribute("TitleTol") }
            },
        }

        var formModel = new[]
        {
            new PropertyVm(typeof(object) , "outer")
            {
                DisplayName = "Laser Alignment",
                NotOptional =true,
                Value=lasers
            },
        };

I also tried it with choices such as #81 (comment) but unfortunately, it doesn't fulfill my requirements with TextBox control.
Is there any other way to do the same?

@mcintyre321
Copy link
Owner

mcintyre321 commented Apr 2, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants