in reply to Adding fields to a form using Catalyst/TT
A previous poster mentioned libraries, which are great. But, understanding comes to me from rolling a few things myself first. Otherwise, I can't conceive of what the library is up to.
Here is a little sample pulled from recent code (Bigtop's tentmaker editor to be specific). I've pruned it a little bit to make it clearer and more general.
Now this is not fancy. Library code would be nicer in a number of ways (notably in cross browser support). But this shows how easy it is to augment an existing document object model (DOM).function add_to_div( div_to_change, new_div_text ) { var div_area = document.getElementById( div_to_change ); var new_node = document.createElement( 'div' ); new_node.innerHTML = new_div_text; div_area.appendChild( new_node ); }
Other than javascript, you can only make round trips to the server, which is <pun_warning /> anything but refreshing.
Phil
|
|---|