sort order

From JustHumans

Jump to: navigation, search

Web browsers submit fields to JustHumans.com in no particular order. As a convenience, JustHumans sorts fields names to keep them in somewhat of a predictable order. But you can dictate a custom sort order for JustHumans.com to use instead of alphabetical order. Lets take the following form:

<html>
 <head>
  <title>Contact</title>
 </head>
 <body>
  <h1>Contact Us!</h1>
  <form method="post">
   Name: <input type="text" name="name" /><br />
   Comments:<br />
   <textarea name="comments"></textarea><br />
   <script language="JavaScript" src="http://verify.justhumans.com/verification.js?k=a1b2c3"></script>
  </form>
 </body>
</html>

As you can see, there are two form fields here, name and comments. Because JustHumans.com will sort these alphabetically by field name, you will always get comments before name. You would probably agree that this is not ideal, so we can add a hidden sort field to dictate that name should come before comments.

<html>
 <head>
  <title>Contact</title>
 </head>
 <body>
  <h1>Contact Us!</h1>
  <form method="post">

   <input type="hidden" name="sort" value="order:name,comments" />

   Name: <input type="text" name="name" /><br />
   Comments:<br />
   <textarea name="comments"></textarea><br />
   <script language="JavaScript" src="http://verify.justhumans.com/verification.js?k=a1b2c3"></script>
  </form>
 </body>
</html>

When this form is submitted, JustHumans will read the sort field and place name before comments.

The value of the sort field must begin with order: or this won't work. Also, the fact that the sort field is "hidden" is unimportant. It won't show up in the JustHumans.com email or database if it is correctly processed as a sort order. Alternatively, if it is improperly formatted, it will show up in your JustHumans.com email or database. So if you get the sort field in an email or the database, it isn't formatted properly. Make sure the value begins with order: as in the example above.

Personal tools
Navigation
Toolbox