Jeff,

You still haven't given a rationale why you *need* the parameters presented in 
a specific order (even though the brower's supposed to produce that result).   
I've worked with a set of generic form processing servlets and never had the 
desperate need to know the order upon receipt; if I'm manually 
inspecting/debugging a submission, I'm doing a "SELECT...ORDER BY..." from a 
database anyway.


My suggestion, if you really, really, really need to know the "order of 
appearance" in the originating <form> (and you don't want to preface each input 
name with an indexing numeric value as suggested earlier):
  a.. write some (client-side) JScript to traverse the document's DOM (starting 
from the <form> node) just PRIOR TO SUBMISSION, 
  b.. create a delimeted string of parameter names for each input node 
encountered
  c.. stuff that delimeted string value into a <input type="hidden" 
name="formInputOrder">
  d.. form.submit();
On the TC/servlet side, 
  a.. get the value of the "formInputOrder" parameter
  b.. pull all the names from the enumeration of param names provided by the 
request
  c.. sort that list based on a Comparator implementation that compares the 
relative positions of each comparee within the "formInputOrder" value  (Note 
that it's always good to wrap both comparees with the delimeter used by the 
"formInputOrder" value.)

This suggestion assumes a fairly distinct set of input names.  If your form has 
multiple inputs with the same name (or a <select> that allows multiple 
options), then, obviously, the above has some weaknesses.




Reply via email to