Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Page extends React.Component {
  2.     this.state = {
  3.             formData: {
  4.                 amount: '',
  5.                 phone: '',
  6.                 name: this.props.userName
  7.             }
  8.  
  9.     handleChange = (event, {name, value}) => {
  10.         if (this.state.formData.hasOwnProperty(name)) {
  11.             this.setState({ formData: {...this.state.formData, [name]: value }});
  12.         }
  13.     }
  14.     render(){
  15.         const { formData, errors, amount_option} = this.state
  16.         const { name, amount, phone } = formData
  17.         const { errorBag } = this.validator
  18.  
  19.     return(
  20.     <form>
  21.         <div className="cp-field">
  22.             <h5>Phone Number</h5>
  23.             <div className="cpp-fiel">
  24.                 <input type="text" name="phone" value={phone} placeholder="Eg. 0123456789" onChange={this.handleChange}></input>
  25.                 <i className="fa fa-lock"></i>
  26.             </div>
  27.         </div>
  28.         <div className="cp-field">
  29.             <h5>Amount</h5>
  30.             <div className="cpp-fiel">
  31.                 <select name="amount" onChange={this.handleChange}>
  32.                     {amount_option.map(function(amount){
  33.                         return <option key={amount.key} value={amount.value}>{amount.text}</option>
  34.                     })}
  35.                 </select>
  36.             </div>
  37.         </div>
  38.         <div className="save-stngs pd2">
  39.             <ul>
  40.                 <li><button type="submit" onClick={this.handleSubmit.bind(this)}>Cash Deposit</button></li>
  41.             </ul>
  42.         </div>
  43.     </form>
  44.     )
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement