hello
this patch fixes a bug in prototype which makes Form.serialize() produce single value inputs where it should produce an array.
run the following html code to see what i mean:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form.serialize() Example</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript">
Event.observe(window, 'load', function() {
console.log(Form.serialize('form'));
});
</script>
</head>
<body>
<form id="form">
<input type="text" name="name[]" value="" />
<input type="text" name="name[]" value="" />
<input type="text" name="address" value="" />
<input type="text" name="phone" value="1234" />
</form>
</body>
</html>
what it prints is: name=&address=&phone=1234
what it should print is something like: name[]=&name[]=&address=&phone=1234
the attached patch fixes the problem which was basically changing the following code in serializeElements if (result[key]) to if (key in result)