Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are several steps that can be taken to make EditContext.Validate() function properly when connecting an array with EditForm:

  1. Ensure that the array property in question is marked as required in the model class. This will ensure that the EditContext.Validate() function checks for a valid value in the array.

  2. Implement the IValidatableObject interface in the model class and add validation logic for the array property in the Validate() method. This will allow for custom validation logic to be executed when the EditContext.Validate() function is called.

  3. Ensure that the EditForm component wraps the array property in a Field component and that the validateOnChange parameter is set to true. This will ensure that the EditContext.Validate() function is called whenever the array property is changed.

  4. Use the EditContext.OnFieldChanged() method to manually trigger the validation of the array property when necessary. This can be useful if the array property is being updated by custom logic outside of the EditForm component.

  5. Use the EditContext.NotifyFieldChanged() method to update the validation state of the array property after making changes to it. This can be useful if the array property is being updated asynchronously.

By following these steps, it should be possible to ensure that EditContext.Validate() functions properly when connecting an array with EditForm.