Dakota St. Laurent

Results 32 comments of Dakota St. Laurent

@prontiol would you be willing to share this code? I was nearly pulling my hair out yesterday, which is a shame 'cause the rest of the library is superb.

ah ok. by "custom `form.values`, do you mean having special handling in the `onSuccess` hook?

for anyone that sees this in the future, this is what I ended up doing: ### Rendered component ```jsx document.getElementById(field.id).click(e)} type="button" > {btnText} ``` ### Form initialization ```js new Form({...

`ServiceMechanicCreate` should use a constructor to initialize the form, e.g. ``` @inject('serviceMechanicStore') @observer class ServiceMechanicCreate extends React.Component { constructor (props) { super(props); this.form = new MobxReactForm( fields, { hooks: {...

@kapilpipaliya do you mean when you submit the form? or when you change the field?

I used the `observers` object to validate one field when a different field changes. An alternative is doing it in `onSubmit`. inside the function, get access to the form object,...

@andrefox333 we just use `validators` instead of `rules` for everywhere we need a custom error message 🤷‍♂ not a real solution since it kinda defeats the purpose of using validatorjs...

@andrefox333 here's an example of a field: ```js { name: 'company_name', type: 'text', validators: [ ({ field }) => { return [ !!field.value, 'Name is incomplete.' ]; } ], value:...

@andrefox333 I've had success with using both, though typically I opt in favour of `validators` for i18n. that being said, I don't use both `rules` and `validators` in the same...