Hello,
I'm trying to add a new module that presents a new node type called 'article.'
This is different from the default story/page nodes in that it should have an additional form field that takes an integer. This integer corresponds to the vBulletin Thread ID where users can comment on the article. (Assumes that the thread is already created)
First, I need to validate that the number in the field is an integer. But I wanted to test to see if my validation code is getting picked up at all by first setting the field to not required, and then the logic to return an error if a single 'x' character is entered. Unfortunately, it didn't seem to pick up on this and so my validation code isn't working. Here it is:
/**
* Implementation of hook_form().
*/
function article_form(&$node) {
$form['title'] = array('#type' => 'textfield', '#title' => t('New WDS Article Title'), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5);
$form['body_filter']['body'] = array('#type' => 'textarea', '#title' => t('WDS Article Body'), '#default_value' => $node->body, '#rows' => 20, '#required' => TRUE);
$form['body_filter']['format'] = filter_form($node->format);
$form['forum_link'] = array('#type' => 'textfield', '#title' => t('Associated Thread ID'), '#forum_link' => t('Thread ID'), '#required' => TRUE, '#default_value' => t(''), '#weight' => 2);