Salesforce Asked by Valarie Simmons on January 25, 2021
I am looking for a solution to hide my html form contents and only display the “Thank You for your submission” text in the same landing page after the submit button is clicked.
My code will perform the following operations:
Can someone show me another simple example on how the form can be hidden? I tried using html script as below, but the form is still not hidden after the submit button is clicked.
<script>
function showHideShipInfo(){
if(document.getElementbyId('submit1').submit){
document.getElementById('formfieldsetid').style.display='none';
}
else {
document.getElementById('formfieldsetid').style.display='block';
}
}
Note: my html code for the submit button is as follows:
input type ="submit" value="Submit" id=submit1 onclick="showHideShipInfo()"
It is actually much simpler than you are thinking. You just need to have the form submit to itself (your current URL) and then have a hidden field of something like <input type="hidden" name="submit" value="1" />
then have AMPScript on the page like follows:
%%[
SET @Submit = RequestParameter('Submit')
IF @Submit != 1 THEN
]%%
<!-- FORM HTML GOES HERE -->
%%[ ELSE ]%%
<!-- THANK YOU HTML GOES HERE -->
%%[ ENDIF ]%%
You can then use your AMPScript to insert into Sales Cloud info and/or POST to your original collection page.
Correct answer by Gortonington on January 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP