Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » Drupal »

No envia formulario.

Estas en el tema de No envia formulario. en el foro de Drupal en Foros del Web. Estoy haciendo un modulo que debe enviar un formulario y recojer los datos en la misma ventana.. hice un codigo que me crea el formulario ...
  #1 (permalink)  
Antiguo 16/12/2008, 00:57
 
Fecha de Ingreso: septiembre-2007
Mensajes: 139
Antigüedad: 16 años, 7 meses
Puntos: 1
No envia formulario.

Estoy haciendo un modulo que debe enviar un formulario y recojer los datos en la misma ventana..
hice un codigo que me crea el formulario pero a la hora de enviar.. no logro recojer los datos con variable_get();
espero que me puedan ayudar.

Código PHP:
<?php
function calculadora_menu() {
  
$items = array();

  
$items['calculadora'] = array(
    
'title' => 'Calculadora',
    
'page callback' => 'calculadora_page',
    
'page arguments' => array('form'),
    
'access arguments' => array('administer site configuration'),
    
'type' => MENU_CALLBACK,
  );
  return 
$items;
}

/**
* Display help and module information
* @param path which path of the site we're displaying help
* @param arg array that holds the current path as would be returned from arg() function
* @return help text for the path
*/
function calculadora_help($path$arg) {
  
$output '';
  switch (
$path) {
    case 
"admin/help#calculadora":
      
$output '<p>'.  t("Muestra un bloque con una calculadora") .'</p>';
      break;
  }
  return 
$output;
}

function 
calculadora_perm() {

return array(
'access calculadora content''administer calculadora');

}

function 
calculadora_block($op 'list'$delta 0$edit = array()) {
  
// The $op parameter determines what piece of information is being requested.
  
switch ($op) {
    case 
'list':
      
$blocks[0] = array(
        
'info' => t('Permite hacer calculos.'),
        
// we definitely do not want this cached
        
'cache' => BLOCK_NO_CACHE,
      );
      return 
$blocks;
    case 
'configure':
      
$form = array();
      if (
$delta == 0) {
        
// All we need to provide is a text field, Drupal will take care of
        // the other block configuration options and the save button.
        
$form['chatblock_number_messages'] = array(
          
'#type' => 'textfield',
          
'#title' => t('Number of messages'),
          
'#size' => 60,
          
'#description' => t('The number of messages to show in this block.'),
          
'#default_value' => variable_get('chatblock_number_messages',  100),
        );
      }
      return 
$form;
    case 
'save':
      if (
$delta == 0) {
        
// Have Drupal save the string to the database.
        
variable_set('chatblock_number_messages'$edit['chatblock_number_messages']);
      }
      return;
    case 
'view':
    
$form = array();
      
        
// All we need to provide is a text field, Drupal will take care of
        // the other block configuration options and the save button.
        
$form['chatblock_number_messages'] = array(
          
'#type' => 'textfield',
          
'#title' => t('Number of messages'),
          
'#size' => 60,
          
'#description' => t('The number of messages to show in this block.'),
          
'#default_value' => variable_get('chatblock_number_messages',  100),
        );
      
// If $op is "view", then we need to generate the block for display
      // purposes. The $delta parameter tells us which block is being requested.
      
$block['subject'] = t('Chat');
      
$block['content'] = t('Chat');
      return 
$block;
  } 
}





function 
calculadora_form() {
  
// Access log settings:
  
$options = array('1' => t('Enabled'), '0' => t('Disabled'));
  
$form['access'] = array(
    
'#type' => 'fieldset'
    
'#title' => t('Calculadora'), 
    
'#tree' => TRUE,
  );
  
$form['access']['numero1'] = array(
    
'#type' => 'textfield'
    
'#title' => t('Numero 1'), 
    
'#size' => 30
    
'#maxlength' => 64
    
'#description' => t('Enter the name for this group of settings'),
  );
  
$form['access']['numero2'] = array(
    
'#type' => 'textfield'
    
'#title' => t('Numero 2'), 
    
'#size' => 30
    
'#maxlength' => 64,
    
'#default_value' =>  variable_get('numero2'0), 
    
'#description' => t('Enter the name for this group of settings'),
  );
  
  
  
// Description
  
$form['details'] = array(
    
'#type' => 'fieldset'
    
'#title' => t('Mostrar/ocultar Operacion'), 
    
'#collapsible' => TRUE
    
'#collapsed' => TRUE,
  );
  
$form['operacion'] = array(
    
'#type' => 'radios'
    
'#title' => t('Log'), 
    
'#default_value' =>  variable_get('log'0), 
    
'#options' => array(t('Sumar'), t('Restar'), t('Multiplicar'), t('Dividir')), 
    
'#description' => t('Selecciona la Operacion.'),
  );

  
  
  
  
$form['submit'] = array('#type' => 'submit''#value' => t('Save'));
  return 
$form;
}

function 
calculadora_page() {
$limitnum variable_get('operacion'3);
  
$tt drupal_get_form('calculadora_form');
  
$tt .= $limitnum;
  return 
$tt;
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:47.