2

My requirement is to generate 1D bar code based on user defined input in the text box. for example if user give 10 as input in the text box then he should able to generate 10 bar code with different serial number after saving the content .... so far, I have used bar code module to generate the bar code and serial module for different serial number and I am able to generate single bar code on saving the content.

enter image description here

now my problem is how to generate series of bar code based on the number which we give as input.

I am not getting how to map the input text box field to content and call multiple time.can any one help on this.

9
  • There is a module Barcode that can help you do that. > The Barcode module provides a text field to generate barcode images.
    – tdd
    Commented Jul 8, 2015 at 7:35
  • Yes but Iam able to generate only one barcode using this module, my requirement is to generate series of barcode.
    – rose
    Commented Jul 8, 2015 at 8:25
  • @Pierre.Vriens: Is there any way to achieve this I have tried a lot but I am unable to crack this.
    – rose
    Commented Jul 8, 2015 at 8:30
  • Thx for the edit, a bit better ... But what's the difference between a "1D" barcode and a "QR code"? Or could a "QR code" also work for you? After I correctly understand the question, I might have a suggestion (answer) for you. PS: please enhance the FORMAT of your question also. E.g. by adding some line breaks in between, and moving the image to a better spot. Commented Jul 8, 2015 at 12:09
  • I think more information is needed , like how the content is selected , do you want to edit content too? If you just want a reference to a node maybe reference module would handle the job Commented Jul 8, 2015 at 12:30

2 Answers 2

0

You have content of type A and it contains a field called B , B is your serial fieldneedrst of all your field B must get multiple values , this can be set through Field UI. If you are going to collect more than 10 values per each content you can select unlimited values , but this has some DB overhead , after that drupal itself will create the form with multiple value , if you have chosen a specific number for that field for example 3 values , there will be 3 widget to get values , else if it is unlimited you will have an ajax add element button . If this is not what you want and you want to enter the number of barcodes at the beggining then you must alter the form using hook_form_alter (you must write a module) , inside that hook add a counter element to your form (it gets the repeatation s count) and then use ajax to add widget to your form . Each widget must be added to your field in your form , so drupal will understand that all the data inserted in these widgets relates to your field. If you want to do it by writing a module and need some code ,I can add some code later.

3
  • Thanks for your response and It Means a lot for me. Problem with me is I am new to this drupal I am not getting What exactly I have to do,and as of now writing a module is very difficult for me. To achieve this requirement Example: assume a user enters 20 as input in a text field and then clicks the save button. It should then generate a 1D barcode for '20'. If however the input gets changed to '50', it should generate a 1D barcode for '50' (with different serial number).is there any way to achieve this please let me know I am trying to figure it out from past many days.
    – rose
    Commented Jul 9, 2015 at 6:54
  • 1
    Sorry if i can't tell you all about drupal module development cause it is too time consuming , there are some good tutorial on that off course , but if you are eager to write a module for that I recommend to learn about how to create .info file and how to alter a form and finally Using ajax in drupal , they are all you need to achieve your goal in this problem . Commented Jul 9, 2015 at 12:58
  • Thank a lot, I will go through the tutorial which you have suggested.
    – rose
    Commented Jul 10, 2015 at 5:53
0

I tried Barcode module and there were no problem for having multiple values , so I recommend you to use this module , off course it is not exactly what you wanted but it can do the job ,

  1. first create a test content type using Structure
  2. add a new field using manage fields to this content
  3. add a field of type Barcode
  4. in the first setting screen choose any type of barcode you wish
  5. in second screen down below you can see Number of values
  6. change it to Unlimited
  7. save and try adding new content

Change field number of accepted value to unlimited

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