function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jd_06jd_06 

Javascript &quot gettng passed as ascii

Hello - I've been banging my head too long on this one.  I'm trying to show a shadowbox of the claim activity when user clicks on the outputlink.  When I click on link nothing happens.  I've noticed that when I hover over the outputlink for a given claim the path shown in IE8 (lower left hand corner) looks something like

 

javascript:showClaim("/a1NRxxxxxxxxxxxx",%20"B-000008%20Quick%20View");

 

It should show up as

 

javascript:showClaim("a1NRxxxxxxxxxxxx", "B-000008 Quick View");

 

The quot is for some reason getting passed as ascii....or so it seems.

 

Please share any thoughts and/or ideas.  Thank you!

 

function showClaim(src, title) {

 

     var box = new parent.SimpleDialog("hersh"+Math.random(), true);

     parent.box = box;

     box.setTitle(title);

     box.createDialog();

     box.setWidth(850);

     src='<a href=\"#\" onclick=\"box.hide();\">Close</a><br/><br/><p><iframe src="' + src + '" style="border:0; width:810px; min-height:           600px"></iframe></p>'

     box.setContentInnerHTML(src);

     box.setupDefaultButtons();

      box.show();

    if( 0 > 0 )

    setTimeout("box.hide();",0);

}

 

Here is my outputpannel

 

<

apex:outputpanelid="DuplicateClaimTable">

     <apex:pageblocksectiontitle="Possible Duplicate Claims"columns="1"rendered="{!dupeClaimToggle}">

          <apex:pageBlockTablevalue="{!dupeClaimList}"var="dupeClaim"style="width:100%">

               <apex:columnstyle="background-color:yellow">

                    <apex:facetname="header">

                                Claim Name

                     </apex:facet>

                                  {!dupeClaim.Name}

                </apex:column>

                <apex:columnstyle="background-color:yellow">

                     <apex:facetname="header">

                                 View claim

                     </apex:facet>

                         <apex:outputLinkvalue="javascript&colon;showClaim(&quot;/{!dupeClaim.Id}&quot;, &quot;{!dupeClaim.Name} Quick View&quot;);"title="View Claim">View Claim</apex:outputLink>

                </apex:column>

           </apex:pageBlockTable>

      </apex:pageblocksection>

</apex:outputpanel>

 

Best Answer chosen by Admin (Salesforce Developers) 
mcrosbymcrosby

You may be able to get by with replacing &quot; with just a single quote (') character.  Also, your &colon; probably isn't going render as expected either.  Try:

 

<apex:outputLink value="javascript&colon;showClaim('/{!dupeClaim.Id}', '{!dupeClaim.Name} Quick View');" title="View Claim">View Claim</apex:outputLink>

 

 The code snippet above is converting the colon (:) to &colon;. 

 

All Answers

mcrosbymcrosby

You may be able to get by with replacing &quot; with just a single quote (') character.  Also, your &colon; probably isn't going render as expected either.  Try:

 

<apex:outputLink value="javascript&colon;showClaim('/{!dupeClaim.Id}', '{!dupeClaim.Name} Quick View');" title="View Claim">View Claim</apex:outputLink>

 

 The code snippet above is converting the colon (:) to &colon;. 

 

This was selected as the best answer
jd_06jd_06

Thanks very much mcrosby, but now it's trying to pass the following.

 

javascript&colon;showClaim('/a1VRxxxxxxxxxxxxx',%20'a1VRxxxxxxxxxxxxxx%20Quick%20View');

 

What's very odd, is that I'm using this same javascript funciton in another controller with essentially identicle syntax, both in the js method and outputlink.  There are only minor differences between the two pages in terms of layout.  One difference between the two pages is that in the page that works, the outputlink is not wrapped in an outputpanel.  I wouldn't think that that would have an impact...but right now I'm at a loss as to why one page works and the other does not.

 

Thanks again....if anything else comes to mind please let me know.

mcrosbymcrosby

The <apex:outputLink> tag looks like it is encoding the data in the value attribute.  You could use a standard <a> tag instead:

 

<a href="#" onclick="showClaim('/{!dupeClaim.Id}', '{!dupeClaim.Name} Quick View'); return false;">View Claim</a>

 

jd_06jd_06

Thanks so much mcrosby!  I revisited your first suggestion, and it appears I may have fat fingered something.  Works like a champ.