Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
Restablecer formulario usando AvForm en reaccionar js

Estoy usando AvForm en React js. Quiero restablecer el formulario después del envío del formulario. Pero no puedo restablecer el código a menos que actualice toda la página. Cada vez que se envía el formulario, conserva el valor anterior pero no restablece los campos

formulario.js

 <AvForm className="form-horizontal" onValidSubmit={(e, v) => { const data = { ...formData, ...v }; setFormData({ ...data }); dispatch( createMarketplaceAccount( { name: data.name, access_id: data.access_id, access_secret: data.access_secret, marketplace: "amazon", aws_credentials: { marketplaces: data.marketplaces.split(","), }, account_id: getUserInfo().account_id, informed_api_key: data.informed_api_key, }, ), ); toggleTabProgress(3); toggleTab(3); }} > <div className="form-group"> <AvField name="access_id" label="Amazon Seller ID:" value="" className="form-control" placeholder="ABC123DE456F78" type="text" required /> </div> <div className="form-group"> <AvField name="access_secret" label="MWS Auth Token:" value="" className="form-control" placeholder="amzn.mws.123e4567-e89b-12d3-a456-426655440000" type="text" required /> </div> <ul className="pager wizard twitter-bs-wizard-pager-link"> <li onClick={() => { toggleTabProgress(1); }} className="btn btn-primary w-md btn-sm waves-effect waves-light" > Previous </li> <li className={activeTabProgress === 4 ? "next disabled" : "next"}> <button type="submit" className="btn btn-primary w-md btn-sm waves-effect waves-light"> Next </button> </li> </ul> </AvForm>

Necesito ayuda. Gracias de antemano. necesito algunas sugerencias

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puede obtener la ref de AvForm y usar reset()

 class Whatever extends React.Component { constructor(props){ super(props); this.handleValidSubmission = this.handleValidSubmission.bind(this); } handleValidSubmission (event, fields) { // do your thing this.form && this.form.reset(); } render() { return ( <AvForm onValidSubmit={this.handleValidSubmission} ref={c => (this.form = c)}> ... Your form fields here ... </AvForm ) } }
over 4 years ago · Santiago Trujillo Report

0

Hassam usa el concepto de estados y configura el estado para que se vacíe cuando sea necesario y asigna ese estado a la propiedad de valor del campo.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!