DrupalBin
Submit Code
About
Recent Posts
Fix for Code
Code
add_to_cart_by_sku_contents()
Fix for page.tpl.php
Page.tpl
foreach is beeing disregarded dispite variable is array. Please help. Outside Drupal it works as standalone.php file
foreach is beeing disregarded dispite variable is array inside drupal. Please help. Outside Drupal it works as standalone.php
Fix for filefield implementation in an admin page. "An HTTP error 0 occurred. /drupal/?q=filefield/ahah///"
PHP Code custom.module
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
›
Fix for Why isn't my submit function being called?
Fix for Fix for Why isn't my submit function being called?
View
Fix
Fixes are not saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
/** * Menu callback. Defines a form for adding and editing people (users). */ function people_edit() { $args = @func_get_arg(0); // If a uid has been passed, pass it on to the form builder function. return $args ? drupal_get_form('people_edit_form', $args) : drupal_get_form('people_edit_form'); } function people_edit_form($form_state) { // Check whether a uid has been passed to the function via a URL argument. // If so, load the user. $uid = @func_get_arg(1); if ($uid) { if (!is_numeric($uid) || !$person = user_load($uid)) { drupal_set_message('The person could not be found.', 'error'); drupal_goto('people'); } } if (!$uid) { $person = NULL; $persona = NULL; } else { // $persona = person array. Creates an array for passing to functions. $persona = (array)$person; drupal_set_title(t('Edit @person-name', array('@person-name' => check_plain($person->profile_name_first . ' ' . $person->profile_name_last)))); } $op = $uid ? 'form' : 'register'; // Copied from user.module: // Create a dummy variable for pass-by-reference parameters. $null = NULL; // Get a list of profile categories and sort them $categories = module_invoke_all('user', 'categories', $null, $person); uasort($categories, '_user_sort'); // Generate form items by category by invoking hook_user() $form = array(); foreach ($categories as $category) { $form = array_merge($form, module_invoke_all('user', $op, $persona, $person, $category['name'])); $form[$category['name']]['#collapsible'] = TRUE; $form[$category['name']]['#collapsed'] = TRUE; } // Get rid of fields that don't apply to the people module unset($form['theme_select'], $form['locale'], $form['account']); $form['submit'] = array( '#type' => 'submit', '#value' => t('Save'), '#weight' => 10, '#submit' => 'people_edit_form_submit', // you may have another submit on your code. In that case you have to specify the submit callback function ); return $form; } /** * Submit handler for the people editing form. */ function people_edit_form_submit($form, &$form_state) { echo 'test'; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.