Drupal

How To Create a Form Callback with Drupal 7 – Part 1

Drupal 7, Website Developing, WordPress

Drupal

INTRODUCTION

Working with Drupal for a couple years, I wanted to create a form with a callback. I admit there are one or two methods to create a Drupal 7 form. I created the form in the module location in the sites/all/modules/custom/{modname}. In this series, will step though a process to create this form. The form submits data into the database and return a message all on the same page without a page reload.

Required Knowledge: Drupal 7, PHP, MySQL, Coding Knowledge, etc…

If you are a new comer to Drupal Module Creation, I will try to cover as much as possible in my series. I will try not to make this too boring for the more advanced people.

CREATE THE MODULE

Modules created are self-recognized by two files that must be in the folder of your newly created custom module.
1. The .module file. Example: signup.module
2. The .info file Example: signup.info

The .module file is where all the custom code is written and can be left empty for this example.

The .info file needs a couple of things to become visible on the Drupal Module Page in the admin area.

The most basic .info file needs some variables assigned, the basic variables are name, description, dependencies array, core and package.

  1. Create the folder named sample all lower case in this location. sites/all/modules/custom/sample
  2. Create the files below.

sample.module

// Intentionally left blank for sample module
// However the file needs to exist in the folder.

sample.info

name = Sample Module
description = this is a newly created sample module
dependencies[] = mods,views
core = 7.x
package = Sample Module For Example Purposes

After typing or copy/pasting all this into the sample.info file and creating a sample.module file you will have this module listed on Drupal Module page.

Before we dive to far into the nuts and bolts of the form creation, beginners will need to understand the basics of Drupal 7 module creation. This watered down version hopefully will help. Use Google to find additional help if needed. I’ll try recording a video soon. The next part of this series will be basics of form creation.

Advertisements
AngularJS

Intro to AngularJS

AngularJS, JavaScript, Website Developing, WordPress
AngularJS

AngularJS

The newest technology to hit the mainstream web developer experience is AngularJS.  Angularjs.org site states, it’s a “Superheroic MVW Framework. ” What that means is–AngularJS extends HTML attributes for a perfect single page application. Still wondering if you want to learn AngularJS? Why do you need convincing? Visit this site to start your first experience in AngularJS: Your First AngularJS App: A Comprehensive Tutorial | Toptal

It’s important to give back to the Open Source community. So once you are an expert at AngularJS be sure to contribute your coding experience. I am educating myself in AngularJS. This site will soon be full of AngularJS examples. Keep in touch.

Frank Thoeny