fapi

Fix for Trying to insert text into "subject" field of the comments form.

  1. /**
  2.    * Implements hook_form_alter.
  3.    * Client wants the subject field to initially be blank.
  4.    * If the user doesn't type in a subject line, then the
  5.  

Fix for Trying to insert text into "subject" field of the comments form.

  1. /**
  2.    * Implements hook_form_alter.
  3.    * Client wants the subject field to initially be blank.
  4.    * If the user doesn't type in a subject line, then the
  5.  

Fix for Code

  1. phptemplate_form($element) {
  2.   $id ='id1,id2,id3,id4,en,nog,een,id';
  3.   if (in_array($element['#id'], explode(',', $id))) {
  4.     $element['attributes']['class'] .= 'JOUWCUSTOMCLASS';
  5.   }

Fix for Code

  1. phptemplate_form($element) {
  2.   $id = 'id1,id2,id3,id4,en,nog,een,id';
  3.   if (strpos($id, $element['#id']) !== FALSE) {
  4.     $element['attributes']['class'] .= 'JOUWCUSTOMCLASS';
  5.   }

Fix for Edit a hidden value with jQuery and have it show up in $form_values (D5)

  1. <?php
  2.  
  3. /**
  4.  * This won't work when you first submit it... the hider will still show 3.
  5.  * Change #value to #default_value on the hidden field for it to work.
  6.  */
  7.  
  8. function test_form() {

Edit a hidden value with jQuery and have it show up in $form_values (D5)

  1. <?php
  2. function test_form() {
  3.   $form['hider'] = array('#type' => 'hidden', '#value' => 3);
  4.   $form['submit'] = array('#type' => 'submit', '#value' => 'Submit');
  5.   return $form;
  6. }

form api radios?

  1.  $form['step1'] = array(
  2.     "#type" => "fieldset",
  3.     "#title" => t("What type of point would you like to add"),
  4.   );
  5.  
  6.   foreach ( $validtypes as $type => $info ) {

FAPI Protection

  1. // AHAH and AJAX implementation
  2. // Get form from cache and store modified selection
  3. $form = form_get_cache($_POST['form_build_id'], $form_state);
  4.                  
  5. // update the select content

AHAH FAPI Callback Helper

  1. // Example usage. This is an AHAH callback function.
  2. function mymodule_ahah() {
  3.   // Update the form and render only the wrapper inside the "Refund Settings"
  4.   // fieldset.

AHAH helper - not yet working

  1. <?php
  2.  
  3. function &ahah_helper_get_form_element($form, $parents) {
  4.   // Allow $parents to be either an array of the element's parents or the name
  5.   // of an element.
Syndicate content