3

Is there any reason why min/max value are limited to the following?

[9999999999999]
- Min is too big (maximum is 2147483647)

I need to add ISBN numbers which are 13-digits. Is there a reason for this min/max length, and can it be increased?

3

Numbers have certain limits in computer systems and storing (as well as working with) exceptionally large ones is cumbersome.

In the database, the int (integer, a whole number) is limited to a range from -2147483648 to 2147483647. A bigint can range from -9223372036854775808 to 9223372036854775807 but is less common. And I don't think Craft uses bigints anywhere.

I know it's purely numerical, but could your ISBN numbers use a text field? Unless you're doing math on it then this should suffice. If you really want you could a new fieldtype that validates an ISBN number but saves as a varchar in the DB.

|improve this answer|||||
  • Ah I see, thanks. My database knowledge is pretty poor so didn't realise this was a limitation of the db. I suppose a text field could do the trick, I can always check with Twig if it's numerical — I expect the alternative option you mention involves a plugin, and my php is nowhere near good enough! – Rob Jul 19 '15 at 22:14
  • 4
    @Rob I can recommend Marion Newlevant's Match Input plugin. It provides a text field that gets validated against custom RexEx patterns, which you define in its field settings. To match exactly 13 digits use this expression: /^\d{13}$/. – carlcs Jul 20 '15 at 8:51
  • @carlcs Ah, sounds good will check it out. Thanks. – Rob Jul 20 '15 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.