Problem with [object Object] being added to links

Debug Report:

chrome_debug.zip (36.3 KB)

I have a strange behaviour when adding external links to a page, not sure if it is a bug or me but I am assuming bug for this report

I have a table which contains links to the forum

So here is a database table containing the link

So I start with a generated bootstrap table which lists these links


All good up till now

Now I add a link into the entry

image

and set its value to the link via dynamic attributes

image

resulting in code:

The link shows [object Object] after it

Clicking the link leads to an incorrect link

image

I have tried numerous variation on the code like

<td><a href="#" dmx-bind:href="{{link}}">Link</a></td>

But still the same problem

Is it possible that you have a component in the same scope with the name link. Try {{json(link)}} as expression, it should format it as json and could help us figure out what the second object is.

Now using

               <tr>
                  <td dmx-text="link">
                    <a href="#" dmx-bind:href="{{json{link}})">Your link title</a>
                  </td>
                </tr>

Still getting:

https://community.wappler.io/t/uploading-multiple-files-to-your-server/4412,[object Object]

Why are you using both dmx-text and content inside the <td>?
If you need the link, remove the dmx-text attribute.

That’s just one of the many combinations I have tried to debug this Teodor,

I am going to change the table field name in case we have a naming conflict with the HTML link attribute
Will report back on that one

Thanks for your time, partricks comment re link scope sent me in the correct direction.

It appears that the name “link” was the problem, i assume an object conflict with the HTML “link” tag
Changing the field name to “forumlink” solved the problem

Thanks for your time on this one, i should have thought of that myself

6 Likes

Thanks for that! Solved my link issue.

Yesss this fixed my issue!I couldn’t get a download button for each table row to work, because I got the object object thing… Now it is fixed. Thanks for sharing :slight_smile:

I was literally pulling my hair out with the same issue with a conditional on a variable yesterday, took me hours to figure out. Turned out the variable id was the same as an AppConnect name/identifier in a parent repeat. Goes to show how important naming conventions can be.