These are chat archives for cjroth/validator.js

12th
Jan 2017
Jason Brock
@derwydd
Jan 12 2017 16:00
Hello, I'm having a problem trying to get ValidatorJS working with a nested object. Using ValidatorJS with Redux-Form

I've tried both methods:
function rules(data){
return {
'test_id': 'required',
'textbox_test1': 'required|max:15',
'ach_limits.limit_1': required|max:500,
'phone_test2': 'required|telephone',
'password_test3': 'required',
'password_test4': 'required|same:password_test3',
'test_select': 'required'
}
}

function rules(data){
return {
test_id: 'required',
textbox_test1: 'required|max:15',
ach_limits:{limit_1: required},
phone_test2: 'required|telephone',
password_test3: 'required',
password_test4: 'required|same:password_test3',
test_select: 'required'
}
}

Jason Brock
@derwydd
Jan 12 2017 17:04
I found that it is flattening the ach_limits:{limit_1:''} into ["ach_limits.limit_1"]
So while I was testing, I pushed ach_limits:{limit_1:''} into validator.errors, and that works with Redux-form... It has to keep its nested structure. Is there a way to prevent this flattening?