Skip to main content

Home/ Drupal for Developers/ Group items tagged form

Rss Feed Group items tagged

Daniel Gregoire

Theming the User Registration Form in Drupal 6 | Trellon - 0 views

  • <?phpfunction themename_theme($existing, $type, $theme, $path) {  return array(    ...    // tell Drupal what template to use for the user register form    'user_register' => array(      'arguments' => array('form' => NULL),      'template' => 'user-register', // this is the name of the template    ),    ...  );}?>
  • <div id="registration_form">  <div class="field">    <?php      print drupal_render($form['account']['name']); // prints the username field    ?>  </div>  <div class="field">    <?php      print drupal_render($form['account']['pass']); // print the password field    ?>  </div>  <div class="field">    <?php        print drupal_render($form['submit']); // print the submit button      ?>    </div>  </div></div>
  • <?php  print '<pre>';  print var_export($form);  print '</pre>';?>
  • ...3 more annotations...
  • Don't forget to render hidden fields or it won't work ;) echo drupal_render($form['timezone']); echo drupal_render($form['form_build_id']); echo drupal_render($form['form_id']);
  • you also have to print the "token" in order to make the form work print drupal_render($form['form_token']);
  • From my own experience using a form tpl.php, you need to print the whole $form at the very end of the template to ensure that the form will validate upon submission. <?php print drupal_render($form); ?> Just adding the hidden form_build_id and the form_id fields will not mean the form will work. Printing the entire form at the end, however, will mean that all the stuff you wanted to hide in making the template will show. For those fields, include "unset" statements for each one: <?php unset($form['field_to_hide']); ?> Please correct me if I'm wrong or if there is a better way to do this.
anonymous

Using CTools for form item dependency / visibility | computerminds - 0 views

  •  
    One of several helpers included in the ctools module, ctools dependency is described on the module page itself as "a simple form widget to make form items appear and disappear based upon the selections in another item". It's designed to make it easy and quick to hide/show form elements based on the value of other form elements in the browser using javascript.
Daniel Gregoire

Apache Solr and Drupal Default's Search | Trellon - 0 views

  • One issue that comes up from ApacheSolr being a separate search page is that the search form does not go to it by default. This is the $search_box in the page.tpl.php template. The way we change this behavior is to add a new submission handler to that form. You can create a custom module for this or put it in your custom theme. <?php/*** Implementation of hook_form_alter()*/function custommodule_form_alter(&$form, $form_state, $form_id) {  // Add submission handler to redirect to apachesolr  if ($form_id == 'search_theme_form') {    // Add a submit, because the search form redirects to a specific place    $form['#submit'][] = 'custommodule_search_submit';  }}/*** Implementation of form submit function*/function custommodule_search_submit($form, &$form_state) {  // Get form ID  $form_id = $form['form_id']['#value'];  // Create new redirect  $form_state['redirect'] = 'search/apachesolr_search/'. trim($form_state['values'][$form_id]);}?>
anonymous

Create Drupal form using theme_table() like module list form - 0 views

  •  
    Create Drupal form using theme_table() like module list form
Scott Blackburn

Form generation | drupaldocs.org - 0 views

  •  
    Functions to enable output of HTML forms and form elements. Drupal uses these functions to achieve consistency in its form presentation, while at the same time simplifying code and reducing the amount of HTML that must be explicitly generated by modules.
Daniel Gregoire

Wrapper ID (form-item) not displayed for Checkboxes / Radio Buttons CCK Fields | drupal... - 1 views

  •   if (!empty($element['#id'])) {    $output .= ' id="'. $element['#id'] .'-wrapper"';  }  else { // if we can't get the #id from $element['#id'] just build it from $element['#name']    $id=explode("[value]", $element['#name']);    $output .= ' id="'. $id[0] .'-wrapper"';  }
  •  
    Small fix for giving radio/checkbox form elements a proper ID on their wrapper. By default in 6.16 and CCK, no proper CSS ID is given to the wrappers of radio buttons and checkboxes, making it impossible to theme the layout of those elements in the form (specifically for me, the node edit forms).
Scott Blackburn

Howto: Theme Drupal forms with PHPTemplate | PC Tips - 0 views

  •  
    With the introduction of the Forms API (FAPI) in Drupal 4.7, module authors got a new, shiny, but above all, powerful tool to generate and validate advanced forms. For some it's such a big leap from Drupal 4.6 that they still feel a bit lost.
Daniel Gregoire

Multi-step Forms in Drupal 6 using variable functions | pingVision - 1 views

  •  
    Unique method for handling multistep forms in Drupal.
Daniel Gregoire

AJAX-ifying Drupal Node Forms | Stella's Website - 8 views

  •  
    Another tutorial on adding AJAX to Drupal 6 forms with FAPI. Based on poll.module like others. This process is not as straightforward as some, which is why it has been improved upon in D7.
Daniel Gregoire

forms_api_reference.html | Drupal API - 0 views

  •  
    Drupal 6 Form API Reference
Hendy Irawan

Drupal Development - 0 views

  •  
    Drupal Development - Presentation Transcript Drupal Code: Day 1 where am i, and how did i get all these arrays Hi. I'm eaton. Drupal is... http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Drupal Core http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Theme Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Theme Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ name = Demo description = Just a simple demo module. core = 6.x function demo_nodeapi(&$node, $op) { global $user; if ($op == 'view') { if ($node->uid == $user->uid) { $node->title . ' [YOUR ARTICLE]'; } } } demo.info demo.module name = Tricky description = A slightly trickier module. core = 6.x function tricky_form_alter(&form, $form_state, $id) { if ($id == 'node_form') { $title['#required'] = FALSE; } } function tricky_install() { drupal_set_message('You just installed Tricky!'); } tricky.info tricky.module tricky.install views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install sprout.install sprout.admin.inc sprout.inc CHANGELOG README views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install sprout.install sprout.admin.inc sprout.inc CHANGELOG README views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install
Scott Blackburn

Problems when Profiles are enabled | drupal.org - 0 views

  •  
    Email Registration: when I enabled Profiles and added fields to the registration form, the username field came back.
Bensan George

forms_api_reference.html | Drupal API - 0 views

shared by Bensan George on 10 Apr 09 - Cached
  •  
    Forms API reference
1 - 20 of 31 Next ›
Showing 20 items per page