I have a link which can be displayed when inserting it straight into the HTML element on a page. This works.
I have created a client profile section where clients can login. What I need to do is “pull” this link address from my collection and display it in my HTML doc, which changes as the logged-in client changes, thus displaying different data for every client.
I have been at it for a few days trying all sorts of different methods, but I can’t seem to get my head around it… Has anybody attempted something similar?
You have to send a message from your code to the html-component for each “client”, pulling the html from your dataset and “message” it to the (cleint side) html inside the html-component.
It works with things like <a href …> and .
Depending on what you’re trying to do, you can do as Giri mentions above or you can try something simpler. You can set the URL of an HTML component from a value in the page’s dataset.
How you do this depends on the type of page you are doing it on.
If it is a dynamic item page, the easiest thing is to do it in the dataset onReady event handler. So, something like this:
If you’re doing this on a page that has a dataset with multiple items, you probably want to use the dataset.onCurrentIndexChanged instead of dataset.onReady.
Thank you for this. It is a dynamic page that I am trying to do this on.
I have a dataset with 6 fields. In my last field I inserted a link to google sheets (specific to each client), which should then update the HTML component as the users change.
I have used your suggested code, replaced #dataset1 with my dataset’s name and updated the htmlComp, but I’m getting an error that says “dataset1” is not a valid sector name. Also, where in this code would I need to specify the specific field name?
I assume you checked that the dataset is properly connected to a collection. Are there other elements connected to this dataset? Are they working properly?
When I do this, the html component displays the wikipedia page, however if I put the wikipedia link inside a textbox (called #text9) and make the source the textbox (see below), it doesn’t work anymore. Any ideas?
What I’ve done was simply to connect a text element to the data which pulls through the link from the database, and then I am trying to make the value of the text element the source for the html element
There is no “value” API.
.text is available, however it only pulls through the plain text in the text element, not the value that updates as users change, meaning it won’t work for my purposes
Now I’m confused. I thought text9 contains a URL that you want to use as the source link for the HTML Component. In that case, using .text should work just fine. It works for me in a test page I’ve created.
However, link value is populated into the text element from a dataset, you will have to wait until the dataset is ready before you pull the value as I mentioned above previously.