Hello, I have a text box that will link to an address, and it is given through a site that is called What3Words. They display the address with three red “///” and three dark blue words. I have a dynamic page that will display the address in this format for each house, and I need to format the text box with the three red slashes and the three blue words. Is there a way to achieve this with Corvid Coding?
The question is not clear enough. Please explain with examples.
Ok, I have a text in a dynamic page. The dynamic page is displaying information for houses (real estate site). Each house has a 3 word parameter that I want to display on the page. The text will display as this:
/// defend.globe.sublet
The slashes are going to be red, the words are going to be blue. I need to format the text box in a way that it is displayed with the different colors. Additionally, I need to hyperlink the text to a variable address, and although I saw that I can do this, I don’t know how to make it variable (for a dynamic page)
$w("#text123").html = '<a href="http://wix.com" target="_blank">Stunning web sites</a>';
The href will be made this way
https:// what3words .com / defend.globe.sublet
The last 3 words are going to change, depending on the house.
I don’t know if you store the text with or without the triple-slash.
but you can try:
$w.onReady(() => {
$w("#dataset1").onReady(() => {
let itemText = $w("#dataset1").getCurrentItem().textField;//use your text field key instead
//this line is only if you store the triple-slash, otherwise skip to the next line:
itemText = itemText.split("///")[1];
//////////////
$w("#text123").html = `<a href="https://what3words.com/${itemText}" target="_blank" style="text-decoration:none;"><span style="color:red">///</span><span style="color:blue">${itemText}</span></a>`;
})
})
Ok, here is what I have:
$w('#w3w').html = '<a href="https://what3words .com/" target="_blank" style="text-decoration:none;"><span>${txtW3W}</span></a>';
When I use style=“text-decoration:none;” it gives me the next error:
An error occurred in one of datasetReady callbacks ReferenceError: supportedValues is not defined
$w('#w3w').html = '<a href="https://what3words . com/" target="_blank"><span>${txtW3W}</span></a>';
Instead of showing the value inside txtW3W, it shows the actual text $(txtW3W). Am I missing something?
I am not worrying about the color in the text for now, all I need is for it to work.
You’re using apostrophe ’ around the html string instead of `
A bit more information on template literals .