Return the sorting form field instead of echoing

Also simplifies jquery inclusion method