Skip to content

Input field doesn't show errors anymore #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mradenovic opened this issue Feb 25, 2018 · 2 comments
Closed

Input field doesn't show errors anymore #44

mradenovic opened this issue Feb 25, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@mradenovic
Copy link
Contributor

Before we switched to react-materialize, input field was showing function error if any on run. Now, the field indicates that there was an error, but it does not display it.

@mradenovic mradenovic added the bug Something isn't working label Feb 25, 2018
@amr08
Copy link
Collaborator

amr08 commented Mar 3, 2018

hmm I can't seem to see any indication that there is an error in the fields other than the html5 warning. What is a way I can trigger one?

@mradenovic
Copy link
Contributor Author

mradenovic commented Mar 3, 2018

Run sum with no params. It will throw Must provide one or more parameters and the bottom border of the input field will turn red. Error message should show up under but it does not.

Error message is set in handleRunCode and passed down to FuncParams. It looks like materialize Input does not pass the message properly.

// FuncCard.js

  handleRunCode(e) {
    let params = this.state.params;
    try {
      let result = this.props.func(...params);
      this.setState({result: result, error: ''});
    }
    catch(err) {
      this.setState({result: '', error: err.message})
    }
  }
// FuncParams.js

  <Input
          value={value}
          id={`${funcName}-input`}
          type="number"
          step="0.01"
          placeholder="Enter number and hit RETURN"
          error={error}
          onChange={this.handleInputChange}
        />

@amr08 amr08 mentioned this issue Mar 4, 2018
@amr08 amr08 closed this as completed Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants