This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Best way to extend all nodes with my module's field set?

An advanced newbie question:

In brief, I need to add a custom group of fields -- to every node. I'm looking for efficiency and extensibility, not simplicity (i.e. I don't mind getting my hands dirty in code). Somehow, I need my group of fields to be accessible wherever a node is used. The fields will be for internal use only, not for display.

It seems there are several ways to extend nodes with custom fields. 1) One can use the CCK editor to add fields manually to each content type. 2) One can create a brand new node module based on an old one but with additional fields built in. 3) Or, one can create a separate table with the additional fields (using nodeID as the primary key) and query that table whenever needed.

So far, option 3 seems the cleanest. However, this required a whole new layer of additional queries to fetch the field group whenever the data is required (which will happen a lot with every page load).

search result of comments links only to the main node

Hi there,

Is it normal that drupal is linking the search result of a comment to the main node and not to the real comment?

When searching for a word or phrase which is part of a comment, the search result only shows the node to which the comment is attached to.
If many comments are added to a node, I have to go over all the comments to eventually get to my "original search hit".

This is really not convenient.

$form_values only available in validate function

Hi,

I'm trying to port a module (called Evaluation) from drupal 4.7.x to drupal 5.x an I have some problems to get the forms work correctly.
The following code shows one of my forms and it's validation:
<?php
// Build the whole form with all elements
function evaluation_admin_roles_or_user_form() {
$form = array();
$form['#pre_render'] = array('evaluation_pre_render'); // set the pre_render function
$form['users'] = evaluation_select_user(); // the input field
// ...
// build the whole form with all elements
// ...
return $form;
}

// create the input field for the username
function evaluation_select_user() {
$form = array(
'#type' => 'textfield',
'#title' => t('Select user'),
'#maxlength' => 60,
'#autocomplete_path' => 'evaluation/autocomplete',
'#description' => t('The user to which the selected questions should be assigned.'),
);
return $form;
}

// callback for the hook_menu()
function evaluation_admin_roles_or_user() {
drupal_set_title(t('Assign questions'));
// The $_GET variable is always empty
return drupal_get_form('evaluation_admin_roles_or_user_form', $form);
}
}

function evaluation_pre_render($form_id, &$form, $next_page = TRUE) {
global $form_values;

// ****************************************
// form_values is always empty here!

Help: hook_nodeapi does not allow me to affect the preview

I can use the view operation to view the data entered into a node, but When I preview a new or existing node, the preview screen does not show anything that I expect.

I tried the operations:

view
submit
prepare
validate

I started with the view operation and it works when the node is finally created, but it seems like the preview is unaccessible.

Right now I'm just using the hook to add additional info into the DB and retrieve some info for presentation when the node.

Calling Stored Procedure from Drupal 5.0

I am trying to call a stored procedure in MySQL 5.0 from Drupal 5.0 but getting an error like

PROCEDURE DBName.ProcName can't return a result set in the given context query: call ProcName() in /public_html/includes/database.mysql.inc on line 167

I am new to PHP but am wondering if I need to be using mysql_query instead of db_query?

Any help is appreciated.

form['#attributes'] being ignored

Per the API example, I'm trying to inject an attribute into a form. Specifically, I'm trying to add a Javascript onsubmit handler like so:

$form['#attributes']=array('onsubmit'=>'my_submit_handler();');

However, Drupal appears to be ignoring the #attributes array. Even when I use the example code of:

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions