Bug in links within repeater?

Hi all, please try this:

  1. add a repeater to a dynamic page (with - say - 3 items)
  2. add a text box within the repeater and create some links (for example, to google, to your home page etc)
  3. preview the repeater – all links work well and the code to the links looks like this:
<p class="font_2" style="font-size:14px; line-height:1.7em;"><span style="text-decoration:underline;"><a href="https://www.delucaarte.it" target="_self">Home</a></span></p>

<p class="font_2" style="font-size:14px; line-height:1.7em;"><span style="text-decoration:underline;"><a href="https://www.delucaarte.it/contact" target="_self">Contacts</a></span></p>

<p class="font_2" style="font-size:14px; line-height:1.7em;"><span style="text-decoration:underline;"><a href="http://www.google.com" target="_blank" data-content="http://www.google.com" data-type="external" rel="undefined">Google</a></span></p> 
  1. now connect your repeater to a database – don’t do anything else
  2. preview the repeater again: all links retain the right style (e.g. underlined), but all links are gone! By inspecting the code I see this:
<p class="font_2" style="font-size:14px; line-height:1.7em;"><span style="text-decoration:underline;"><a>Home</a></span></p>
<p class="font_2" style="font-size:14px; line-height:1.7em;"><span style="text-decoration:underline;"><a>Contacts</a></span></p>
<p class="font_2" style="font-size:14px; line-height:1.7em;"><span style="text-decoration:underline;"><a>Google</a></span></p>
 

As you can see, all the “href” keywords are gone. It looks like a bug to me… Please try this at this link: https://www.delucaarte.it/delucaarte/test_123/Latest

Thanks,
Mauro

Hi Mauro,
If you wish to have links, you should have a URL field type in your collection and bind the text element to the URL field.

Good luck,
Tal.

Hi Tal,

I have not been clear enough, sorry. I try again and hope to explain better.

Say you have a repeater with just 1) an image and 2) a text below the image. The image is taken from a database whereas the text is always the same (it is not connected to the DB). The Text contains a link to an email address:

While the repeater works well (all the required images are displayed and the text is correctly shown below each image), the link in the text does not work and in particular the “href” part is missing from the code (see below).

If you want to see the issue, please click on this link:

https://www.andreadelucaarte.it/delucaarte/test_123/drawings

If I inspect the code generated by wix I find this:

 <p class="font_2" style="font-size:14px; line-height:1.7em;">Like this painting? Then send me an email -- <span style="text-decoration:underline;"><a>info@delucaarte.it</a></span></p> 

and as you can see the href is missing after the tag.

Therefore, the page appears like this:

but the links are useless.

What am I doing wrong? Since the text box is not connected to anything it should be simply copied from the template to each of the repeater items… or should it?

Thanks
Mauro

Hi Mauro:

I think what Tal is saying is that the effect you managed to get using the text version of the link is most likely to do with how the browser renders what it thinks of as a possibly URL. To be sure that youre link works you need to tell the wix code that what you have IS a URL by using the correct wix element mapping. I think you are right in that Tal assumed you were getting the link from the dataset. But her general guidance is still valid.

I think what you need to do is change your string to being an html snippet and assign it to your textbox, something like this ( note this needs to be a Text element not a TextBox as TextBox doesn’t have an html property):

$w("#paintingMessage").html = '<span><b>Like this painting? Then send me an email --</b><a href="mailto:info@delucaarte.it">info@delucaarte.it</a></span>';

Check this out


Hope this helps!

Thank you very much for your detailed suggestion! I will try and let you know.
Best regards,
Mauro

Hi again,

I did this:

$w.onReady(function () {
$w("#dynamicDataset").onReady( () => {
      $w('#repeater2').forEachItem( ($w, itemData, index) => {
         $w("#paintingMessage").html = '<span><b>Like this painting? Then send me an email --</b><a href="mailto:info@delucaarte.it">info@delucaarte.it</a></span>';
       } );
  } );
});


but the problem is the same (please check https://www.andreadelucaarte.it/delucaarte/test_123/drawings).

it looks like a bug to me…

Thanks again,
Mauro

p.s. this is the code generated by wix:
Like this painting? Then send me an email –info@delucaarte.it
again no href.

Hi Mauro:

Try changing the name of the scope variable in your forEachItem function

$w.onReady(function () {
    $w("#dynamicDataset").onReady( () => {
    // Use $itemScope not $w for repeater scoped elements
         $w('#repeater2').forEachItem( ($itemScope, itemData, index) => {
              $itemScope("#paintingMessage").html = '<span><b>Like this painting? Then send me an email --</b><a href="mailto:info@delucaarte.it">info@delucaarte.it</a></span>'; 
         } ); 
     } );
 });

Steve

Hi Steve,

thanks again, but same story. The code generated is still wrong:

Like this painting? Then send me an email – info@delucaarte.it

→ Can anyone from wix please comment and confirm the bug?

Mauro

Hi Mauro:
I wonder what other page configuration or dataset configuration you have.
I have created a dynamic page similar to yours with the email as described above which works.

Take a look at this:
https://stcroppe.wixsite.com/steveonsoftware/HobbiesAndPastimes/

You probably need someone to take a look at your page in the Editor. Wix can do that. If you would like me to I can also but you would need to make me a contributor temporarily.

Cheers
Steve

Hi Steve,

I see that your page works well… I will start from your code and try to find my mistake… you have done already enough and I don’t want you to waste more time with this! :slight_smile:

Hope to report soon that I finally have a working page…

Thanks again,
Mauro

p…s please don’t remove your link