Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
foooo
* Readme
calendaring thing
form thing for testing stuff
Web-viewer for curl
4
found
auth
Name:
Category: foooo
Body:
// load page, you get a textarea; type a form in the textarea and "submit", it puts that form underneath the textarea. when you submit it // you get the formcode back again in the textarea. It could be used to make testing stuff easier. <form action="" method="post" accept-charset="utf-8" id="form-maker"> <textarea id="form-maker-code" rows="30" cols="80"><?php echo htmlents(@$_REQUEST['form_maker_code']); ?></textarea><br> <input type='button' value='html → form' class='submit'> </form> <div id="form-maker-target"></div> <script> $(function(){ // action name $('#form-maker .submit').on('click', function() { var html = $('#form-maker-code').val(); $('#form-maker-target').html(html); var code = "<input type='hidden' name='form_maker_code' value='"+htmlents(html)+"'>"; $('#form-maker-target').find('form').append(code); }); }); // htmlents(str) function htmlents(str) { return String(str) .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/</g, '<') .replace(/>/g, '>'); } </script>
Footer