You need to sign in to do that
Don't have an account?
ywamtsv
How do I pass modified javascript output to apex component?
I am trying to get a download button for all the attachments in a custom object (which AppExchange doesn't seem to have).
I have a class, component, and visualforce page that works great with static ID's, but I need it to be dynamic.
{!Involvement__c.Attachments} will output: [00Pxxxx, 00Pxxyz, 00P12345]
I think use javascript to strip out the components that break the button.
The button only works with comma separated values, eg: 00P123,00Pxyz,00P987
I can get it to display the ID's I need, but can't get it into the attachmentIds="" inside the component.
Help!
<apex:page standardController="Involvement__c"> <apex:outputText value="{!Involvement__c.Attachments}" id="attachments" rendered="true"> </apex:outputText> <script type="text/javascript"> var a = document.getElementById('{!$Component.attachments}').innerHTML; var step0 = a.replace("]",""); var step1 = step0.replace("[",""); var final = step1.replace(/ /g,""); document.write(final); </script> <br/><br/><br/> <c:VFZip attachmentIds="" generatedFileName="myzip" mode="button" id="thebutton"/> </apex:page>
Now, how can I get that Component button to be the button the Object Page?