6 ?><script type=
"text/javascript">
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
")?>");
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')) ?>' )};
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();
32 if($visiblePreviewFields.length == 0){
33 jQuery(
'#preview_' + fieldId).hide();
34 jQuery(
'#upload_' + fieldId).show(
'slow');
gravityview()
The main GravityView wrapper function.