<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Arial">I didn't get any bites on this one
on the support list, so I'm hoping some of you development gurus can
help me.<br>
<br>
</font></font><font size="-1"><font face="Arial">I would like to add a
simple area
calculator form (length x width x depth = area) to a sidebar block, and
I'm having problems figuring how to get the form to show up in the
block using hook_block(). I've gotten the block to show up in the
blocks list and have enabled it, but I can't get it to show up. I've
been using the blocks chapter in the PDD book as a guideline, but I
must be missing something.<br>
<br>
Here's what I have so far.<br>
<br>
<?php<br>
<br>
function calculate_square_form() {<br>
$form['length'] = array(<br>
'#title' => t('Length'),<br>
'#type' => 'textfield',<br>
);<br>
<br>
$form['width'] = array(<br>
'#title' => t('Width'),<br>
'#type' => 'textfield',<br>
); <br>
<br>
$form['depth'] = array(<br>
'#title' => t('Depth'),<br>
'#type' => 'textfield',<br>
);<br>
<br>
</font></font><font size="-1"><font face="Arial"> $form['depth'] =
array(<br>
'#title' => t('Area'),<br>
'#type' => 'textfield',<br>
);</font></font><br>
<font size="-1"><font face="Arial"><br>
$form['length'] = array(<br>
'#type' => 'button',<br>
'#value' => t('Calculate area')<br>
);<br>
} <br>
<br>
function shbark_calculate_block($op = 'list', $delta = 0, $edit =
array()) {<br>
switch ($op) {<br>
case 'list':<br>
$blocks[0]['info'] = t('Square area calculator');<br>
return $blocks;<br>
<br>
case 'view':<br>
$block['subject'] = t('Area calcultor');<br>
drupal_get_form('calculate_square_form');<br>
break;<br>
}<br>
}<br>
<br>
How do I get my block content to be displayed? Do I have to pass the
form to a theme function? Do I assign the form data to
$block['content'] somehow? Or do I have to put the form array in the
'view' case for $op instead of a separate form function?<br>
<br>
Thanks.<br>
<br>
Steve</font></font><br>
</body>
</html>