Posted by class01 on June 14, 2010 at 2:50am
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
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?
The Boise Drupal Guy!
Thanks for your help
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
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'])).The Boise Drupal Guy!