Validate Child Block Form Data Used in List in Parent Block
Application Type
Traditional Web

Hi All,

Child Web Block holds a form and that web Block is used inside a list in parent web block. Now want to validate the form fields for each of the list records . The validation logic is inside child block but unable to get the reference of all form instances (I means each form records in the list) to run a loop and test the validation logic and update the form data.


Forms Block (Child) : holds the form , Update & Update All Button , logic to validate form details and update the data. Taken a reference of List type as input parameter in the Forms block.

Parent Block : Contains a list , the child web block is part of that list. List Source is a local variable with Structure Type.

mvp_badge
MVP

Hello Arpit,

If I understood correctly, you have a form contained in a webblock, and this webblock is used in a parent webblock to aggregate these forms.

What does your validation logic need to do? Would it not be possible for each child webblock to validate the data it contains? What I'm thinking is that if each child webblock does not need to know what else is going on in the list, then each child webblock can validate itself when changes happen, report the result to the parent webblock, and then the parent webblock holds a List of the validation results that can be checked when the user tries to submit the complete form.


Any help , Guys ?

Hi Arpit,

As I have understands your requirement, you need to validate the form inside the child block. 

For that you don't required the for each, validate each filed of form separatly and then use IsValidForm.

Then you can use create or UPdate the data. 


Hope this helps,

Komal

Hi Komal ,

The issue is : suppose I have 3 records in the list , the form fields variables only storing the last record's values as all the form fields are bind with same variable. I also need to validate all forms in the list with the UpdateAll Button. 

Hi Arpit,

Create local list of entity type and append the data in the form to that list when user modifyes the data if not then append it form the main entity (which is being used for displaying the data) and in the save button, loop on local list and validate all the data and in the same loop use updateEntity action.


I would suggest instead of form use Table and at the last row of table use update button in which all the current data get validated and also updated in DB if user has changed some data.

Hope this helps,

Komal

Hi Komal ,

Sorry I didn't get much from your answer. I have a local variable name Form Data(which is of record Type) and fields are bind with FormData.FirstName and FormData.Mobile etc. This form is in a web block and web block is in a List which is in another web block.

Now I want to validate the form inputs (of all forms in the list) at one go. The problem  I am facing that Currently the form variables only holds the data of the last form in the list which is not the desired thing.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.