So, I'd like to do some DHTML stuff in a couple of my node forms. For example, I would like to show users different text boxes for completion based upon the selection of a radio button.
I'm familiar with the numerous was to do this outside of the Drupal forms API, but I'm wondering how to do this the Drupal way.
Here's an example of what I'm doing and would like to do:
<?php
/**
* Implementation of hook_form().
*/
function guide_form(&$node) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Guide Title),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5);
$form['body'] = array(
'#type' => 'textarea',
'#title' => t('Guide Description'),
'#default_value' => $node->body,
'#weight' => -2,
'#rows' => 20,
'#required' => FALSE);
//I want to put a couple of radio buttons here to selectively display the pgid or suid textboxes
//Users should only be able to enter data for one or the other.
$form['pgid'] = array(
'#type' => 'textfield',
'#title' => t('Pagescribe Page ID (LibData)'),
'#required' => TRUE,
'#default_value' => $node->pgid,
'#weight' => 6
);
$form['suid'] = array(
'#type' => 'textfield',
'#title' => t('RQS ID (LibData)'),
'#required' => TRUE,
'#default_value' => $node->suid,
'#weight' => 6
);
$form['core'] = array(
'#type' => 'select',