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

216
Views
JS: Getting location.href from array of objects

I have an array of form objects and I have like to get the url in the form objects if it met a condition. I tried like below:

    <div
      onClick={() =>
        (location.href = `${_.filter(forms, function (form) {
          console.log('url 84390')
          console.log(row.form_id)
          console.log(form.id)
          if (form.id === row.form_id) {
            console.log(form.formUrl). //form.formUrl is correctly printed out  /staff/forms/xgcba
            return form.formUrl
          }
        })}`)
      }
    >
      {row.form_id}
    </div>

However, I got the error as below:

No route matches [GET] "/staff/[object%20Object]"

I think form.formUrl is not correctly assigned to location.href. Any help would be greatly appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It works as below.

 const handleUrl = (row) => {
    forms.map((form) => {
      if (form.id === row.form_id) {
        location.href = form.formUrl
      }
    })
  }
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!