mobx-react-form: Wrong deep field path for initField() on update()

if i have a form that is defined

// this was edited to correct a typo. was originally "const rules"
const fields =[
	'name',
	'list.cat1',
	'list.cat1[].name',
	'list.cat1[].url',
	'list.cat2',
	'list.cat2[].name',
	'list.cat2[].url',
]

is it correct for me to define the rules like:

const rules = {
	'name': 'string|required|between:1,255',
	'list.cat1[].url' : 'url|required',
	'list.cat2[].url' : 'url|required',
}

when i attempt to validate the form, it appears that the nested fields are not getting validated. i.e. list.cat1[].url and list.cat2[].url

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

awesome. just tried it out. works. Thanks very much for all your support and quick response!

thanks again for quick response. wierd, i just checked my code and in fact i’m doing what you recommend. I must be making a mistake somewhere that is causing different behavior.

I haven’t noticed the validation issue after update that you mention. thanks for the heads up and i’ll watch for it

ok. Thank you for the generous offer. I’ll review it again first and if i still can’t figure it out i’ll ping you.