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

form _submit() and _validate() hooks are not executed

Hello,

I'm fairly new to drupal module development and I've been reading up on the new forms API, which I think is great except that I can't get submit and validation hooks to work.

I am using drupal 5.1 with PHP 4.4.4 on Debian etch.

I've written some quick code to illustrate my problem and I'd be grateful for any help. I'm sure I'm missing something trivial.

Test case:
After loading the module, I go to to http://hostname/entry
This displays the form, but when I hit "submit", neither of the two hooks are executed; instead, I get redirected to "/test" right away, which is defined as the '#action' of the form; this in turn displays "blah" (see below).

I'd be glad for any help.

-- tel


<?php

function test_menu($may_cache) {
$items = array();

$items[] = array(
'path' => 'test',
'title' => t('Test Page'),
'callback' => 'test_view',
'access' => 'access test',
'type' => MENU_CALLBACK
);
$items[] = array(
'path' => 'entry',
'title' => t('Test Page - Entry page'),
'callback' => 'test_page',
'access' => 'access test',
'type' => MENU_CALLBACK
);

return $items;
}

function test_perm() {
return array('access test');
}

function test_page() {
return drupal_get_form('test_form');
}

function test_view() {
// TODO
return "blah";
}

Unknown column 'n.nid' errors for something REALLY basic

I've tried everything I can think of, and this error wont' go away. I've read all the topics about errors of similar nature and none of them make any sense (or seem to target my issue. So, unfortunately the forums are my last resort because I'm lost in confusion :-|

This is my sql statement:

$query = "SELECT r.rid, r.tid FROM {acidfree_roles} r";
$roleObj = db_query( db_rewrite_sql( $query ) );

Now, when I run this as the Admin user I get all the data I need back from the SQL query, but when I run it as any other users I get the 'red box' on my node creation call (this code is in a form_alter for the image module). The error I get is:

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT r.rid, r.tid FROM acidfree_roles r INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all'))) in /home/sites/mystudentbible.com/public_html/includes/database.mysql.inc on line 172.

Now, where I'm lost... the reason column n.nid doesn't exist? I don't have one in my acidfree_roles table that I personally created for my module. Why the heck is it taking all that other crap on the end of my simple SQL statement with all that JOIN information?

how to Show number of users in block?

Hi All,

How can i show current number of users, logged in users, active users in simple block on my website?
It would be great if there is any way of showing number of users in footer of main page.

Thanks
Niraj

How best to hook the URL routing mechanism?

I'm new to Drupal modules, so please be patient with my question. :) I want to write a module and would like to get as much guidance as possible. I will write, debug, test, and contribute the module but I will need help from some of the resident Gurus to do so.

I want to write a module that would allow an admin to specify templates for URL routing that, if matched, would override the URLs stored in the URL field for a Node. Essentially I'd like to be able to define URL templates globally for a website that would allow an admin to specify that URLs be defined for content-types. This module would be dependent on the View module and either the Node Relativity and/or the Node Reference CCK Field module. Let me explain by example.

Assume you want to keep track of sports teams by league. In North America the leagues might be NFL, NBA, NHL, MLB, and so on. Further, teams might be Atlanta Falcons, Detroit Pistons, Philadelphia Flyers, New York Yankees, and so on. So assuming I set up node relativity where the league is parent to the team then I should be able to define the following URL templates (note I'm using the URI Template syntax):

How to add new Argument Types into Views module?

I've looked for the solution to this question and I think I may have seen it but if so I didn't recognize it because I'm brand new to building Drupal modules.

General info about revision mechanism?

Hello,

i apologize if this question has been asked before, but i didn't seem to find info about this. I was wondering if any one could help me in finding some information about the revision system in drupal 5. For newbies, an article detailing how it works, how to use it via the api, it's limitations and strengths, etc.

there seems to be no documentation about this feature (at least i didn't find any)

thanks for your help! :)

Pages

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