Code Monkey home page Code Monkey logo

neoform's People

Contributors

apntzls avatar deepsweet avatar filipstefansson avatar mistadikay avatar mr-wildcard avatar tirli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neoform's Issues

Issue with FieldValidation

Hi,

This is my first time reporting an issue so apologies if it's none too legible. I'm having an issue with the FieldValidation function that is used to wrap the exported input element, as follows.

  • export default Field(FieldValidation(TextInput));

I'm seeing the type error as follows:

  • Uncaught TypeError: neoform.getValidation is not a function.

Please may you advise on the best course of action? Thanks for the package by the way! It's been a great help.

PS: Attached below is the input in its entirety, if that helps.

import React from 'react';
import { Field } from 'neoform';
import TextField from 'material-ui/TextField';
import { FieldValidation } from 'neoform-validation';

const TextInput = ({
    autoComplete,
    type,
    defaultValue,
    className,
    floatingLabelText,
    value,
    onChange,
    rows,
    disabled,
    hintText,
    validate
    }) => (
        <TextField
            autoComplete={autoComplete}
            type={type}
            value={value}
            onChange={(e) => onChange(e.target.value)}
            rows={rows}
            disabled={disabled}
            hintText={hintText}
            floatingLabelText={floatingLabelText}
            className={className}
            defaultValue={defaultValue}
            onBlur={validate}
        />
    );

export default Field(FieldValidation(TextInput));

Correct peer dependencies

Caret version ranges specified for versions 0.x only allows patch updates. neoform-plain-object-helpers, neoform-plain-object-helpers, and neoform-validation all need version ranges compatible with neoform 0.3.

Validation Requirement changes

I had an situation where the validator passed to thefield had to change depending on other changes in other parts of the form.

Unfortunately, since we register the validator function once during componentDidMount, it can't pick up changes in the validator function. https://github.com/zero-plus-x/neoform/blob/master/packages/neoform-validation/src/fieldValidation.js#L18

I had to implement componentWillReceiveProps in the fieldValidation to check if there are any differences in the validator function and register the new function.

componentWillReceiveProps(nextProps) {
    if (nextProps.validator && nextProps.validator !== this.props.validator) {
        this.context.neoform.registerValidator(this.props.name, nextProps.validator);
    }
}

I might be doing this wrong, I will be glad if there is another way. Thanks.

Need to know in validator which event fired it

Hi,

It seems like I cannot detect in validator function which event fired it. For example, I have an email field which is checked for validity(has @) onChange and it also has async validation which checks if it's allowed to use such email. Both this checks related to email field, so with the current approach it will look like that:

function validateEmailField(value) {
  return Promise.all(emailValidator(value), availabilityValidator(value));
}

though I don't need to check availability on each change. I want to check it on submit like that

function validateEmailField(value, type) {
  const validates = [];

  switch (type) {
    case 'change':
      validates.push(emailValidator(value));
      break;
    case 'submit':
      validates.push(availabilityValidator(value));
      break;
    default:
      break;
  }

  return Promise.all(validates);
}

So I think it would be great if you (or I can create PR) will add support for event types to this call

Neoform doesn't work with [email protected]

./node_modules/neoform/es/form.js
14:16-34 'recompose' does not contain an export named 'createEagerFactory'.

I upgraded recompose in my project to version 0.26 and I'm getting this error.

Dependency on recompose

I see that both neoform and neoform-validation depends on recompose. It was a recompact before. Why have you changed that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.