Forum

Thread tagged as: Question

Number field types

Is there anything I need to do to get Perch to treat the contents of a field as a number - can I get a field to accept numbers for example? Also, when ordering by a field that only contains numbers, will Perch order correctly.

Eg will 400 come after 50 (in an alpha-numeric sort 400 would come first).

Paul Bell

Paul Bell 0 points

  • 6 years ago

pretty sure

type="number"

works, and will only validate numeric values.

Drew McLellan

Drew McLellan 2638 points
Perch Support

When sorting, use:

'sort-type' => 'numeric',