I have a bundle of image nodes of the same content type that I create in my custom form. Each image node has a field that contains a unique reference number to that node. Currently it is up to the user to add +1 to the previous image node saved and type that in the form for the next reference number. How can I add +1 to the last saved field and use the result to populate the saved field displayed on the saved node? More advanced: If I use an AJAX form that allows users to add more fields to add more pictures on the image creation form, how could I save the images with consecutive IDs?

  • 2
    Have you got some snippets of your code so far? If you are creating nodes with node_save, IDs will be set and returned for you... Apr 12, 2012 at 9:24
  • You can use Rules module, you should see simple videos to learn how to do it if you does not use Rules yet. Oct 14, 2012 at 13:46
  • Keep in mind file attachments already have a unique id in the file id ( fid ) Jan 6, 2013 at 20:42

1 Answer 1


You can use the module Prepopulate ; latest release is dev but I use it on a production site and it works like a charm.

If it doesn't work tell me, there are two other solutions : send an arg in the URL to the form (and then use Panels or the php template) and JavaScript (I can give you the code if you need it).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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