I'm having an issue getting a button to execute javascript correctly on a Visualforce page. The button is supposed to execute an Apsona Merge Action, but instead, it just refreshes the page.
When I put the javascript into a Custom Button, it works fine. So I know the javascript itself is working, but there must be something wrong with the way I have it here:
<apex:includeScript value="https://service.apsona.com/sfdc/apsona_inline.min.js"/>
<script type="text/javascript">
// script to make sure Apsona has session ID
sforce.connection.sessionId = "{!$Api.Session_ID}";
// hack that prevents Salesforce from always putting focus
// on the first date field
window.onload = function() { }
</script>
<button onclick="apsona.runAction ('buttonMerge', {
'actionId': 'a2Of0000000RJ1BEAW',
'recordId': '{!Campaign.Id}',
'linkFieldId': 'Id',
'element': this
});">VIP CRCF</button>
Any suggestions?