Spliting up a CCK node entry form

Events happening in the community are now at Drupal community events on www.drupal.org.
class01's picture

Hello,

I'd like to create a custom edit node form but only have it display two CCK fields in a node + the submit buttons, how can this be done?

I'd also like to preserve the default edit node form so I don't think hook_alter will do the job.

Thanks,

Jonathan

Comments

The "Body" field can be

Garrett Albright's picture

The "Body" field can be removed by editing a content type and setting the "Body field label" (under "Submission form settings") to blank. The title field can be hidden using Automatic Nodetitles.

But this approach is effectively not preserving the default edit node form. Perhaps a better approach would be to use a form altering hook, but have it conditionally do nothing. Under what conditions do you want to show the default form versus the altered one?

Thanks for your help

class01's picture

Thanks for your help Garrett,

I've got no real conditions to display the altered form, it's just that my particular content I've created contains a lot of fields and would make more sense to the user to break it down into separate forms and display it through a lightbox.

How would you suggest displaying it conditionally through a lightbox link. I've already created a page that can contain the form. So would it be best to create a form hook and then conditionally code it to check the url arguements?

Cheers

An approach like that is

Garrett Albright's picture

An approach like that is probably the direction I'd go in, yes. Add a query fragment to the path of the form page when you call it through the lightbox - something like "?lightbox=1" - and then in your form alter hook, do something like if (isset($_GET['lightbox'])).

Content Construction Kit (CCK)

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: