I thought I read all the posts regarding Forms and looked through the Forms API so many times already, but still can't get it. I get the actual form rendering in the node, but it doesn't save any content in a database. Any help would be appreciated.
I have a node called New Leads - it actually has all the business leads that come in. I also created a node called Schedule Event and placed a reference field to the New Leads node ID. The goal is to place a small form on the New Leads node page to be able to schedule an evens for the current lead and then show those events in calendar.
The only problem I have is a custom form that I want to place on the new leads page to schedule an event. Here is the code I wrote based on the Form API Quickstart Guide:
Assuming the form appears on the currently viewed new lead node.
<?php
$nid = $node->nid; //nid of current lead
function schedule_event_form($nid) {
// Lead ID
$form['field_lead_id'] = array(
'#type' => 'textfield',
'#title' => t('Lead ID'),
'#required' => TRUE,
'#default_value' => $nid,
'#weight' => -6,
'#description' => t('Lead ID this task belongs to')
);
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Task'),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5,
'#description' => t('Task summary')