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

setting a form_set_error for a checkbox

I'm trying to set a custom error for a checkbox:

This is the code I'm using for the form:

$form['legalcheckoff'] = array(
'#type' => 'checkbox',
'#title' => ('I agree to the terms.'),
'#required' => TRUE,
'#return_value' => '1',
'#default_value' => '0',
);

And this is in the validate function:

if ($form["legalcheckoff"] == '0') {
form_set_error('legalcheckoff', t('You must check the I agree box.'));
}

Trouble with form API... Dynamic creation of multiple page forms?

Hey all

I've updated my tablemanager module to 4.7 bar an impossible situation with sorting... But I figured I'd deal with that after I'm satisfied that I've coded the rest of the module as best I can. Anyways, the new form API has made me program certain parts of my module an awful lot better - thanks for that! ;o) But... And there's always a but... There's still parts of the new form API which I still don't understand how to treat properly. My latest hurdle is the new table creation form; it works as-is, but is literally a bad upgrade of the old code... So I want to know how to do it properly. I don't need someone to do it for me, just some guidelines would be great!

Here's what I need to do:

User clicks 'add new table' (obviously I've already done this bit!)
Is then asked to give table a name and then the amount of columns the table will have.
So... The next page will dynamically display a number of fields taken from the value above so the user can name each column and set the default column which will be shown sorted when the table is displayed in its default state (and which direction to sort in)
Lastly, the user clicks on create and the table is created.

Now obviously I already have this code written so again it's just an outline I'm looking for. The multipage submit example in the docs is far too confusing for me to follow and besides, it appears to me that it's not possible to create the textfields dynamically as far as I can tell? I kind of wish that example was a LOT simpler... It covers far too many areas to be straightforward (bearing in mind I learnt all I know about PHP from playing around with the snippets).

awTags 4.7 delayed :-(

autowitch.org is hurting bad. Uptime is measured in minutes, the default OS is Memtest86.

I'm working on getting awTags 4.7 out as soon as possible, but extensive (and seemingly never ending) problems with the server and damaged databases is tying up all of my time.

I apologize for the delays.

-aw

understanding AJAX PHP handler

I've got a huge problem understanding this one thing. How do I use the Drupal framework (the database access in particular) from within the PHP handler of an AJAX session? I mean, doesn't this mean executing the whole of Drupal everytime an AJAX request comes? I've been dwelling into the contents of modules incorporating AJAX techniques with db access and still can't figure out how this is possible.. I've also read the AJAX part of the module developer handbook to no avail.. Can someone please explain me. Thanks a lot.

-Ville

Sections (or similar) for 4.7)

I've just upgraded a site that I need sections for because the "Youth" section looks different and I'm giving users the option to style their blogs differently.

However, sections doesn't seem to work in 4.7. Has anyone found a way round this?

Cheers.

Does Drupal Mod the installed Modules?

I'm still using Drupal 4.6 I have not attempted the upgrade or anything, but I have noticed something recently and wanted to ask a question.

Does Drupal alter the modules after you install them and enable them?

I am running 4.6 and I installed the Quote module. I can get it to work, but there are two issues with it right now. It doesn't give me the quote button and I get an error on the administer->quote section:

Fatal error: Call to undefined function: node_get_types() in /home/kato/public_html/modules/quote/quote.module on line 160

Pages

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