Multiple submit buttons in a single form

Prototype only :/

Hello - this code snippet will allow you to submit a form with multiple submit buttons to different targets..
The Implementation is very Simple:
put the following code either inside a
tag on your page or put it in a separate js file

Next you have to Configure your buttons:
Set their class to "multiplesubmit" and their rel to that page where your form should be submitted

You're done

The js-code:
	this snippet will allow to submit a single form with different buttons to different locations
	usage: set the class "multiplesubmit" to your buttons and a rel-attribute inside your button
	where the actionparameter of the form should go
	for example:
		<form method="post">
			<button rel="" class="multiplesubmit">I submit to a.php</button>
			<button rel="" class="multiplesubmit">I submit to b.php</button>

function submitMultiple(event)
{"multi submit debug");

	var ele = event.currentTarget;"pressed on:");;

	var rel = ele.readAttribute('rel');
	if (!rel)
		console.error("You have to place the form action into the rel attribute of your button");
		return false;

	// finding the parent form
	var par = ele.up(0);
	while(par.tagName.toLowerCase() != 'form')
		par = par.up(0);
	if (!par)
		console.error("You have to place your buttons inside a form");
		return false;
	console.log('got parent form:');
	var form = par;

	// setting the action of the form to that one inside rel'set the form action to:');;
	form.action = rel;

	return false;

document.observe("dom:loaded", function() {
	$$('.multiplesubmit').each(function(d){d.observe('click', submitMultiple);});