newforms icon indicating copy to clipboard operation
newforms copied to clipboard

Simplest quickstart example error- Invariant Violation: RenderForm.render()

Open iftheshoefritz opened this issue 8 years ago • 0 comments

Based on (a copy/paste, really) the example at the top of the quickstart I have the following:

var SignupForm = forms.Form.extend({
  username: forms.CharField(),
  email: forms.EmailField(),
  password: forms.CharField({widget: forms.PasswordInput}),
  confirmPassword: forms.CharField({widget: forms.PasswordInput}),
  acceptTerms: forms.BooleanField({required: true})
});

var Signup = React.createClass({
  render: function() {
    return (
      <form>
        <forms.RenderForm form={SignupForm} ref="signupForm"/>
        <button>Sign Up</button>
      </form>
    );
  }
});

This fails with the following error in the chrome console:

Uncaught Error: Invariant Violation: RenderForm.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.

The problem seems to be in the <forms.RenderForm> line, if I remove that the error goes away, but of course I don't see my fields.

iftheshoefritz avatar Nov 01 '15 14:11 iftheshoefritz