Here is another post about some little tool I've made..
This one will take a set of checkboxes and radio buttons (anywhere on a page, doesn't have to be in a table or anything) and turn it into a block of text.
Caveat: you can't have any other checkboxes or radio buttons on the page with this snippet, it will behave poorly.
Check out the source below to see how it works. 21 Lines long, the value="" can be as long as you want. Post a comment if you have any questions.
This could be used for any type of text generation.
Sample | |
Client gets the code | |
I get the code |
Agreement
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js"></script> <table> <tr><td><input type="checkbox" value="This is a long paragraph of text that explains this part of the agreement" /></td><td>Sample</td></tr> <tr><td><input type="radio" name="1A" value="A paragraph of text explaining that the client gets the code. A paragraph of text explaining that the client gets the code. A paragraph of text explaining that the client gets the code. A paragraph of text explaining that the client gets the code. A paragraph of text explaining that the client gets the code A paragraph of text explaining that the client gets the code." /></td><td>Client gets the code</td></tr> <tr><td><input type="radio" name="1A" value="I get this code!!! I get this code!!! I get this code!!! I get this code!!! I get this code!!! I get this code!!! I get this code!!! I get this code!!! I get this code!!! " /></td><td>I get the code</td></tr> </table> Agreement<br /> <textarea rows="6" cols="40" id="agreement"></textarea> <br/><br/> <button onclick="process()">Process</button> <script type="text/javascript"> function process() { var agr = ""; $("input:checked").each(function(i){ agr += $(this).val() + "\n\n"; }); $("#agreement").val(agr); } </script>
11th January 2009
I won't ever give out your email address. I don't publish comments but if you'd like to write to me then you could use this form.
I'm Issac. I live in Oakland. I make things for fun and money. I use electronics and computers and software. I manage teams and projects top to bottom. I've worked as a consultant, software engineer, hardware designer, artist, technology director and team lead. I do occasional fabrication in wood and plastic and metal. I run a boutique interactive agency with my brother Kasey and a roving cast of experts at Kelly Creative Tech. I was the Director of Technology for Nonchalance during the The Latitude Society project. I was the Lead Web Developer and then Technical Marketing Engineer at Nebula, which made an OpenStack Appliance. I've been building things on the web and in person since leaving Ohio State University's Electrical and Computer engineering program in 2007. Lots of other really dorky things happened to me before that, like dropping out of high school to go to university, getting an Eagle Scout award, and getting 6th in a state-wide algebra competition. I have an affinity for hopscotch.