3

Why does my Apex visualforce email template change html hyperlinks in APEX Repeat

Code for apex repeat:

                     <apex:repeat var="QP" value="{!recipient.Quoted_Products__r}">
                        <tr>
                        <td  style="font-size:14px; color:black;font-family:verdana, arial, sans-serif; border-bottom: solid 1px black;"><a href="{!QP.Quote_Email_Product_URL__c}">{!QP.Product__c}</a></td>
                        <td align="right"  style="font-size:14px; color:black; border-bottom: solid 1px black; nowrap">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${!QP.Amount__c}0</td>
                        </tr>
                        <tr>
                        <td  style="font-size:10px; color:black;font-family:verdana, arial, sans-serif;nowrap"><div style="padding-left: 20px;">{!QP.Description__c}</div><br></br></td>
                        </tr>
                    </apex:repeat>

URL that is set by {!QP.Quote_Email_Product_URL__c} but the email template shows the URL as "/https://www.createspace.com/Services/TemplateInterior.jsp". Why is it adding an extra "/" before the URL address?

3
  • Does the leading "/" not occur if you output the field separately (not in the repeat)? – JimRae Feb 5 '14 at 16:51
  • I had something similar but the "/" was not appearing. Could you check if the "/" is not in the field value too? – T. Rossi Feb 5 '14 at 17:08
  • There was a / in the html email template. I removed it, but now the APEX repeat is removing a / from the address so it appears https:/www.createspace.com href now looks like this in apex repeat "<a href="{!QP.Quote_Email_Product_URL__c}">{!QP.Product__c}</a>" – Jason K Feb 5 '14 at 19:27
1

I found the answer. You cannot use href in APEX repeat without issues. I used apex:outputLink:

<*apex:outputLink value="{!QP.Quote_Email_Product_URL_c}">{!QP.Product_c}</apex:outputLink>*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.