GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
inline-javascript.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file inline-javascript.php
4  * @global GravityView_Edit_Entry_Render $object
5  */
6 ?><script type="text/javascript">
7 
8  function DeleteFile(leadId, fieldId, deleteButton){
9  if(confirm('<?php echo esc_js( __("Would you like to permanently delete this file? 'Cancel' to stop. 'OK' to delete", 'gk-gravityview') ); ?>')){
10  var fileIndex = jQuery(deleteButton).parent().index();
11  var mysack = new sack("<?php echo admin_url("admin-ajax.php")?>");
12  mysack.execute = 1;
13  mysack.method = 'POST';
14  mysack.setVar( "action", "rg_delete_file" );
15  mysack.setVar( "rg_delete_file", "<?php echo wp_create_nonce("rg_delete_file") ?>" );
16  mysack.setVar( "lead_id", leadId );
17  mysack.setVar( "field_id", fieldId );
18  mysack.setVar( "file_index", fileIndex );
19  mysack.onError = function() { alert('<?php echo esc_js(__('Ajax error while deleting field.', 'gk-gravityview')) ?>' )};
20  mysack.runAJAX();
21 
22  return true;
23  }
24  }
25 
26  function EndDeleteFile(fieldId, fileIndex){
27  var previewFileSelector = "#preview_existing_files_" + fieldId + " .ginput_preview";
28  var $previewFiles = jQuery(previewFileSelector);
29  var rr = $previewFiles.eq(fileIndex);
30  $previewFiles.eq(fileIndex).remove();
31  var $visiblePreviewFields = jQuery(previewFileSelector);
32  if($visiblePreviewFields.length == 0){
33  jQuery('#preview_' + fieldId).hide();
34  jQuery('#upload_' + fieldId).show('slow');
35  }
36  }
37 
38 </script>
$visiblePreviewFields
gravityview()
The main GravityView wrapper function.