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

Forms API and the missing fields

I am writing a new module that makes extensive use of hook_nodeapi to attach an arbitrary number of images to an existing nodetype. The code works fine except for one *very* frustrating problem that I can't for the life of me figure out.

I modify the existing forms using hook_form_alter().
If I enter data into my new fields, and click submit, everything works fine.

If I click preview, my problems begin:
All of the form elements are rendered correctly on the HTML form, but if I click preview or submit again, their values are not added to $node and my application fails.

The form element is set up in hook_form_alter() as follows:

    $form['nodeimages']['nodeimage']['#tree'] = TRUE;
    $form['nodeimages']['nodeimage']['new']['caption'] = array(
        '#type' => 'textfield',
        '#title' => t('Caption'),
        '#default_value' => $node->nodeimage['new']['caption'],
        '#size' => 40,
        '#maxlength' => 255);

I don't know if I am missing something important here, but at what point to the values in $_POST get added to $node (if ever)? If they don't, how do I go about accessing them from within the Drupal framework.

I have scoured the forums and looked at some of the other modules that ship with 4.7, but I can't seem to find an obvious cause/solution.

If anyone can point out what I am missing, I will really appreciate it.

Create dynamic menu with products and taxonomy?

Hi :)

I'm currently creating a webshop with the eCommerce module and have met some problems. I'd like to organize my products in categories and then create a dynamic javascript menu that lists the actual categories.

This question actually consist of two parts:

1. How do I organize my products in categories?
I'm using the taxonomy module to organize my flexinodes, but when I create a new product, I cannot choose a taxonomy the same way I can with regular nodes / flexinodes.

Single Sign On solutions -- relative advantages and disadvantages

I'm in the midst of looking at different single sign on solutions, and I'm looking for some feedback on the relative advantages and disadvantages of the existing options -- and/or pointers toward resources I've overlooked.

Here are some of the options on my short list (in no particular order):

.

Currently, I'm looking most closely at OpenID and PubCookie. The eventual goal from all this is to create and document a system that allows single sign on between multiple Drupal sites, and Drupal sites and sites created in other open source apps. Ideally, these apps can reside on different servers, and in different domains (one of the key advantages of OpenID).

Simplenews -- relative urls

I have begun using Simplenews which appears to be just the thing I need.

However, I want to add dynamic content to the emails, like the "upcoming events" block. So I put in a php snippet. This works fine.

The problem I am having is that the urls are not absolute. The link is "node/17" because this is all the event module does with it. The full url is added later in the page construction process.

Any suggestions?

Mail recent added content to registered users

I'm using 4.6 and want to send an email every 2 weeks to all registered users on the site with links to the new content in the past 2 weeks. I was wondering what the best way to go about this was. Has anyone ever coded something to do this? I've been looking at the various mail modules on the site:

Seeking suggestions for setting up a development environment

I'd like to begin learning more about Drupal and PHP. I don't know PHP or any other programming really, although I've done some work with VBA to create some macros and user forms in Word. So, I'm seeking some suggestions about a recommended setup to learn PHP, specifically, how it's used to run Drupal modules and themes.

Pages

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