Active
Project:
ISBN Field
Version:
6.x-1.0-alpha2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Jan 2011 at 02:08 UTC
Updated:
19 May 2015 at 13:00 UTC
Jump to comment: Most recent
Would it be possible to make the configurations for the ISBN field from radio buttons to check list? I would like to accept both ISBN-10 and ISBN-13 numbers using one field. Is this possible as well as advisable?
I ask this because I have seen ISBN-10 and ISBN-13 numbers displayed with and without hyphens although isbn.org states that they should have hyphens. If I instruct the user to enter the digits only, no hyphens and no spaces, then the only issue would be with handling cases when hyphens are entered.
I am sure there is a great reason why radio buttons were implemented, but could someone explain why? Validation perhaps? Is it best to implement separate fields for each type?
Thanks
Comments
Comment #1
obair2 commentedThe solution I used was using an integer field and entering a maximum value of 9999999999999 (13 nine's) . I added help text saying that please remove hyphens and spaces.
By the way, the validation wasn't working for me. I set the validation using with and without javascript and entered a 18 digit number and nothing happened. It saved the number. Am i missing something ?
Comment #2
Stomper commentedGood idea on using the integer field type. I also added no hyphen/space help text to my applications. Are you also collecting/accepting any ISBN type in your application?
Thanks
Comment #3
obair2 commentedI have a single field called ISBN. I didn't keep different ISBN types (10 or 13) separately. By the way from #1 requirement I think you should have a look at this module http://drupal.org/project/activeselect . Let me know if it works for you.
Comment #4
Stomper commentedThanks for the module suggestion, unfortunately it does not have a D6 version. I'll probably give your approach a go.
Comment #5
lsolesen commented+1
Comment #6
Stomper commentedI think I will just go with obair2's technique of using an integer field. Is there any problem with using a text field instead? I mean, it's not likely you're going to perform arithmetic on an ISBN right?
Comment #7
Stomper commentedThis is weird. I am not sure if this is a Views thing or something else (Content displayed in table view). But I have used the Integer field method and have set the max value to 9999999999999 (13 9s) so that it can cater everything up to ISBN13. But on the live create content form, the field only lets me enter 10 characters and only prints 10 too.
What could be causing this?
Comment #8
Stomper commentedJust noticed that I cannot correctly save any value I enter in the field. It defaults to "2147483647" which is a PHP issue because it can't handle such a large number. The number is called the Marsenne prime http://en.wikipedia.org/wiki/2147483647.
See http://drupal.org/node/664338#comment-4359582
I think the best option is to go to a text field rather than an integer field. Perhaps a float field.
Comment #9
Marc Storms commentedUsing an integer field is no solution as in some cases the ISBN check digit has the value X.
I have not read an answer to Stomper's question "Why is a radio button used"?
The way working around is converting 10 to 13 digits with http://www.isbn.org/converterpub.asp - see http://drupal.org/node/537384
Or creating 2 ISBN fields: ISBN10 and ISBN13 (with a conditional field if there is need to make it required).
Comment #10
Nick.Dee commentedI agree with Marc. Your best bet would probably be to just convert the ISBN 10 to ISBN 13. Any of the solutions from http://lookup-isbn.com/isbn-converter/ will work just fine for that.