add_action( 'gform_after_submission_12', 'after_submission', 10, 2 ); function after_submission($form) { $get_entry_data = rgar( $form, '9' ); if(rgar($form, '9')=='1721'){ echo "<script> var link = document.createElement('a'); link.href = '/wp-content/uploads/2020/08/eBook-Cellular-Failover.pdf'; link.download = 'download'; link.target = '_blank'; link.dispatchEvent(new MouseEvent('click')); </script>"; }elseif(rgar($form, '9')=='1708'){ echo "<script> var link = document.createElement('a'); link.href = '/wp-content/uploads/2020/08/eBook-Definitive-Guide-to-ZTP.pdf'; link.download = 'download'; link.target = '_blank'; link.dispatchEvent(new MouseEvent('click')); </script>"; } elseif(rgar($form, '9')=='1675'){ echo "<script> var link = document.createElement('a'); link.href = '/wp-content/uploads/2020/08/GGE-OOB.pdf'; link.download = 'download'; link.target = '_blank'; link.dispatchEvent(new MouseEvent('click')); </script>"; } elseif(rgar($form, '9')=='1686'){ echo "<script> var link = document.createElement('a'); link.href = '/wp-content/uploads/2020/08/eBook-Enterprise-Networking-Survival-Guide.pdf'; link.download = 'download'; link.target = '_blank'; link.dispatchEvent(new MouseEvent('click')); </script>"; } elseif(rgar($form, '9')=='1693'){ echo "<script> var link = document.createElement('a'); link.href = '/wp-content/uploads/2020/08/eBook-Evolve-with-SD-Branch-to-Solve-Three-Major-SD-WAN-Problems.pdf'; link.download = 'download'; link.target = '_blank'; link.dispatchEvent(new MouseEvent('click')); </script>"; } elseif(rgar($form, '9')=='1699'){ echo "<script> var link = document.createElement('a'); link.href = '/wp-content/uploads/2020/08/eBook-How-Automation-is-Transforming-the-Datacenter-Landscape.pdf'; link.download = 'download'; link.target = '_blank'; link.dispatchEvent(new MouseEvent('click')); </script>"; } }
Jagdish Sarma Edited question January 11, 2021