I have 4.7.3,

I want to add a field to the form that people fill out when they create a node.

I want to add an image upload field, but- this is very important- I don't want the image to show up in the actual article. I just want it to be associated with the data, in the database. So, for example, the img_assist module won't work. Since it puts the image into the actual node contents.

How can I add a field to the node creation form? I'm very good with PHP, thanks,

rw

Comments

catch’s picture

From what you posted the upload.module (included with drupal core) should work fine.

Rotwang’s picture

OK but that created something on the actual page at the bottom:

Attachment Size
test.gif 89.09 KB

I don't want anything showing up on the page, I want it in the data only, as stated. Generally, how would I add a new field to a form in drupal? I can handle all the php if I can escape the drupal constraints.

catch’s picture

It also creates an option to list, or not list, the file, thus preventing display at the bottom of the node.

All you need to do is change the default to "not list", then hide that part of the user interface, and voila.

Or you could hide the display of the upload attachments at the theme level with a node.tpl.php file.

Or you could install CCK and create a custom field.

Or you could create a module from scratch and use form_alter to add the field.

Rotwang’s picture

I made a module from scratch. :) thanks.

Although now ironically I wish I could REMOVE the file attachment form elemnt section from my custom node's creation form.