0

I have simple from which i used semantic-ui-react to create it :

  <Form onSubmit={this.handleSubmit.bind(this)}>
          <Form.Field>
            <Input placeholder="From ..." type="text" ref="from" />
            <Label pointing>please enter valid email adress</Label>
          </Form.Field>
          <Divider />

now i cant access to value's of the input. here is my code:

  from: this.refs.from.value

it's all undefined.how can fix this ?

Oleksandr Fediashov
  • 4,315
  • 1
  • 24
  • 42
amir
  • 2,443
  • 3
  • 22
  • 49
  • At any point during the code is returning something from either `this.refs.from.value` or `this.refs.from`. I'd start by checking that first. – Rodrigo Aug 29 '17 at 14:01
  • @Rodrigo no nothing. – amir Aug 29 '17 at 14:58
  • Did you try what Alexander suggested in His answer?. Perhaps keeping track of the input's state using `onChange` would allow you to get the data from the component's `state`. – Rodrigo Aug 29 '17 at 15:56

1 Answers1

0

I recommend to use Form and related components in the controlled way, because most of SUIR components are functional, so they don't support refs. I've a codepen to show it in action. There is also example in docs.

Oleksandr Fediashov
  • 4,315
  • 1
  • 24
  • 42