Guest User

Untitled

a guest
Nov 13th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import * as React from 'react';
  2. import {
  3. Button,
  4. FormGroup,
  5. Input,
  6. Label
  7. } from 'reactstrap';
  8. import {observer} from 'mobx-react';
  9.  
  10. @observer
  11. export class LoginForm extends React.Component {
  12. form: any;
  13. username: any;
  14. password: any;
  15. OnLogin (){
  16. console.log("username:",this.username);
  17. console.log("username value:",this.username.value);
  18. }
  19. render(){
  20. return (
  21. <form className="form" ref={(form:any)=>{this.form = form}}>
  22. <FormGroup>
  23. <Label>Sign In</Label>
  24. <Input type="text" name="username" ref={(username:any)=>{this.username = username}} id="username" placeholder="enter your username"/>
  25. <Input type="password" name="password" ref={(password:any)=>{this.password = password}} id="password" placeholder="enter your password"/>
  26. <Button color="primary" onClick={this.OnLogin.bind(this)}>{"Login"}</Button>{' '}
  27. </FormGroup>
  28. </form>
  29. )
  30. }
  31. }
  32.  
  33. OnLogin (){
  34. let formData: any = new FormData(form);
  35. console.log(formData.fd.get('upload_for'));
  36. console.log("username:",formData.fd.get('username'));
  37. }
Add Comment
Please, Sign In to add comment