0

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... – joevallender Apr 12 '12 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. – abd Oct 14 '12 at 13:46
  • Keep in mind file attachments already have a unique id in the file id ( fid ) – David Thomas Jan 6 '13 at 20:42
0

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, privacy policy and cookie policy

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