How to add/check Input validation on dynamically created Form?

benazir0benazir0 Member ✭✭
edited November 2018 in Xamarin.Forms

I need to create views dynamically. I do so from a JSON file that contains the data and placement of each elements (StackLayout, Grid, Entry, Lable,...). Then, in a for loop, I create child layouts/views and add it to the parent layout.

For simplicity let's say I have created this view bellow dynamically on a page:

  • StackLayout (parent)
  • Grid (child)
  • Three rows: Label, Entry and a submit button
  1. How do check whether the Entry is empty or not on submit button click?
  2. Is it possible or should I use MVVM for dynamically created contents on a page?


  • AmitManchandaAmitManchanda USMember ✭✭

    @benazir0 You can do it in MVVM as well. Just create a list property related to your custom fields with all the validation needed. Save your field name and text as well in your list object and on submit check each filed with the validations.

Sign In or Register to comment.