I have a Visualforce page that's a form which is linked to my custom object in Salesforce.
However, I want the form to be saved and then redirected the user to my second Visualforce page (Thank You Page) without me using an apex extension page.
I was told I can use JavaScript to do so however the code that I have written is not working as expected.
This is the code that I've got so far:
<apex:actionFunction name="saverecordandredirect" action="{!save}" oncomplete="location.href = '{! $Page.ThankYouPage }'" /> <apex:commandButton value="Save it" onclick="saveandredirtect() ;"/>
So please if anyone knows how I can achieve this, please let me know!