Created
September 11, 2013 16:53
-
-
Save JamoCA/6526495 to your computer and use it in GitHub Desktop.
This is an easy method to visually reconstruct a form post using copy-and-paste data. I use this script to repost ColdFusion CFDump data from a reported error. (This scripts requires jQuery & HandsOnTable.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE> | |
<html> | |
<head> | |
<title>Form Re-Post</title> | |
<link rel="stylesheet" type="text/css" media="screen" href="http://handsontable.com/dist/jquery.handsontable.full.css"> | |
<script src="http://handsontable.com/lib/jquery.min.js" type="text/javascript"></script> | |
<script src="http://handsontable.com/dist/jquery.handsontable.full.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
var table_Data = $('#table_Data'); | |
table_Data.handsontable({ | |
minRows: 5, | |
minCols: 2, | |
minSpareRows: 5, | |
autoWrapRow: true, | |
colHeaders: true, | |
contextMenu: true, | |
columnSorting: true, | |
manualColumnResize: true, | |
stretchH: 'all', | |
currentRowClassName: 'currentRow', | |
currentColClassName: 'currentCol', | |
contextMenu: ['row_above', 'row_below', 'remove_row', 'undo', 'redo'], | |
fixedColumnsLeft: 2, | |
colHeaders: ["FieldName","FieldData"], | |
columns: [ | |
{type: 'text'}, | |
{type: 'text'} | |
], | |
afterRender: function(){ | |
$('.table_hdr').css('width', $('.wtHider').css('width')); | |
} | |
}); | |
$('#table_Data table').addClass('table table-bordered table-striped table-hover'); | |
var js_Data = table_Data.data('handsontable'); | |
$('.saveBtn').click(function(){ | |
var f = '', v = '', fCount = 0, arr = js_Data.getData(); | |
$('.f').remove(); | |
$('#saveForm').attr('action', $('#FormURL').val()); | |
$.each(arr, function(index, item) { | |
if (typeof item['0'] === 'undefined') { | |
} else if ($.trim(item['0']) != ''){ | |
fCount += 1; | |
v = $.trim(item['1']); | |
if (v == '[empty string]') {v = '';} | |
f = '<textarea name="'+ $.trim(item['0']) +'" class="f" style="display:none;">'+ v +'<\/textarea>'; | |
$('#saveForm').append(f); | |
} | |
}); | |
if ($('#saveForm').attr('action') == ''){ | |
alert('Enter target Form URL.'); | |
} else if (fCount == 0){ | |
alert('No form fields to post. Please enter some fields.'); | |
} else { | |
$('#saveForm').submit(); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Form Post Generator</h1> | |
<p>Enter a target URL, copy & paste data into the jQuery <a href="http://handsontable.com/" target="_blank">Handsontable</a> plugin and submit form.</p> | |
<b><span style="color:#f00;">*</span>TARGET POST URL:</b><br> | |
<form><input type="text" id="FormURL" name="FormURL" value="" style="width:95%;"></form> | |
<form id="saveForm" action="" method="post" target="_blank"> | |
<input type="button" value="Submit Form" class="saveBtn"> | |
</form> | |
<b><span style="color:#f00;">*</span>FORM Data:</b><br> | |
<div id="table_Data" style="overflow:scroll;"></div> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment