The "Add order status"-form currently does not have any validation. Entering a non-numeric value for weight or a display name that is too long will trigger a nasty database error. The attached patch:

  • Uses the 'machine_name'-element for machine name, limiting allowed characters to a-z, 0-9, underscores and hyphens. It additionally verifies that the machine name does not yet exist.
  • Limits the length on the maximum length on machine name, display name and weight fields.
  • Adds validation to ensure the weight field has a numeric value.
  • Changes the label on the order state field from "Display name" to "Order state".