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

189
Views
how can i separate the two values

Form Option:

<Form.Group className="mb-3">
        <Form.Select
          as="select"
          onChange={(e) => {
            setCodigos(e.target.value);
          }}
     >
          <option value="">Código de Manutenção</option>
          {dataCodigos.map((doc) => (
            <option
              key={doc.id}
              value={`${doc.codigo} - ${doc.observacoes}`}
           
            >
              {`${doc.codigo} - ${
                doc.observacoes ? doc.observacoes : "Sem Observação"
              }`}
            </option>
          ))}
        </Form.Select>
      </Form.Group>

I map the options from firebase, and i want to save the doc.codigo and doc.observacoes separate. This way i save the data together

value={`${doc.codigo} - ${doc.observacoes}`} 

setCodigos(e.target.value)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

onChange event needs to use the split method. Below is the code

<select className="form-control form-control-sm"
      onChange={(e) => {
      var arr = e.target.value.split("-");
      setCodigos({codigo: arr[0],observacoes: arr[1]});
 }}
>
about 4 years ago · Juan Pablo Isaza 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!