By kasmel04 on
I have a module in mind that I'd like to build. I've already created a template and the css rules to make it work, and have tested it by manually creating a custom content type.
What I'm trying to do is create the custom content type form in the module, but I need it to include a couple image upload fields.
I'm fine with making it dependent on cck/imagefield and using those mechanisms, I just haven't been able to find any useful information on how to do that.
Comments
This is what has worked for
This is what has worked for me:
1) Install the CCK, filefield, and imagefield modules.
2) Go to: YOURSITEADDRESS/admin/content/node-type/YOURNODETYPE/fields
3) Add a new field (field type = file, widget = image)
This creates an image upload field associated with your node type.
Hope that helps!
thanks for the reply
I'm not doing this for the purpose of building a site, I actually already have a site where I've deployed the template as a content type using contemplate and created the form fields manually.
What I'm trying to accomplish is to implement cck fields in a custom node form generated by a module.
This is what I have so far
I'm not sure what [#field_info] is for, or what to put in there, or if this is correct for drupal 6.
I got this far from looking at http://groups.drupal.org/node/16542
Just hoping for a little more help to figure out the rest
what you're doing has worked
what you're doing has worked for me. Here's a snippet from a form definition function in one of my custom modules:
And there's a bunch of submit handling code as well.
Thank you!
That helped a lot! I now have a far greater appreciation for the API.
Now to get the submit code worked out. I hope to not have to ask too many more questions there.
if you can't get the submit
if you can't get the submit code working, post what you have and we'll take a look at it together.
what I have so far
This code builds the form for a content type
The above works beautifully. I created the fields manually using CCK, and now am trying to implement them in this module. Having tried several methods for getting the content to update upon form submission, I expect that I'm missing something altogether.
The title and body fields are saved just fine, but the CCK fields are ignored.
the echo $name;
that's in there for scaffolding...I was playing with different fields types/naming conventions
Getting the value of these
Getting the value of these fields should follow the standard approach of using $form_state['values']. Try something like this:
to see if you are getting the value for field_1 passed into the submit handler.
$form += (array)
$form += (array) content_field_form works for fields that are not grouped, what should we use to handle field groups? HELP! I've been pulling my hair since last night for this. and now i'm almost bald!