Reputation: 95
Is there any way to reorder or manipulate a set of inputs before posting to a script for processing? I'm able to reorder the elements in the DOM no problem, but getting this to happen after the user presses the submit button and before the browser makes the POST is a bit tricky. I'm using the ajaxForm plugin in jQuery. There is a beforeSubmit callback, but this doesn't seem to allow me to reorded the inputs.
Upvotes: 2
Views: 340
Reputation: 95
$('#form').ajaxForm({ beforeSerialize: orderInputsFunction });
This works. With the jQuery Form Plugin, you can manipulate the form using a call back function with the beforeSerialize option.
In my unfortunate case, I'm working with a PHP script that assumes certain post variables will be in a particular order.
Upvotes: 1
Reputation: 25704
As far as I know, the order the inputs are sent to the server is not guaranteed by the spec (correct me if I'm wrong). So what's the point of reordering them? I don't see why this is useful.
Upvotes: 2