By m3n0R on
Hi all guys !
I have problems with a form, because i want to edit or delete something created by me.
Here is the first image :
http://img189.imageshack.us/i/encima.png/
http://img64.imageshack.us/img64/2352/noencontrada.png
I have problems with menu_hook and form hook:
I want to see something at page, i think i do it correctly but it seems to be something wrong. Can u help me plz??
//hook menu
$items['user/metalinks/%metalinks/edit/'] = array(
'title' => t('Editar'),
'page callback' => 'drupal_get_form',
'page arguments' => array('metalinks_form'),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['user/metalinks/%metalinks/delete/'] = array(
'title' => t('Borrar'),
'page callback' => 'drupal_get_form',
'page arguments' => array('metalinks_form'),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
//function_build_rows
$rows[] = array(
l($row->name,$row->link),
$may_edit ? l(t('edit'), 'user/metalinks/'.$row->lid.'/edit/') : '',//%row->lid'/*.$row->lid*/) : '',
$may_delete ? l(t('delete'), 'user/metalinks/'.$row->lid.'/delete/') : ''///*.$row->lid*/) : ''
);
i don't know why, but it doesn't entry at this form
function metalinks_form(&$node, $form_state) {
global $user;
echo "JAIIIIIIIIIII";
var_dump("hola");
$form['metalinks'] = array(
'#type' => 'fieldset',
'#title' => t('Edita el nom del link'),
);
$form['metalinks']['edita'] = array(
'#type' => 'textfield',
'#title' => t('edita el link'),
'#default_value' => t()
);
Comments
Hey, try following
//hook menu
$items['user/metalinks/%metalinks/edit/'] = array(
'title' => t('Editar'),
'page callback' => 'mymodule_call_form',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['user/metalinks/%metalinks/delete/'] = array(
'title' => t('Borrar'),
'page callback' => 'mymodule_call_form',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
// function_build_rows
$rows[] = array(
l($row->name,$row->link),
$may_edit ? l(t('edit'), 'user/metalinks/'.$row->lid.'/edit/') : '',//%row->lid'/*.$row->lid*/) : '',
$may_delete ? l(t('delete'), 'user/metalinks/'.$row->lid.'/delete/') : ''///*.$row->lid*/) : ''
);
// call form in page
function mymodule_call_form() {
return drupal_get_form('metalinks_form');
}
// your form code
function metalinks_form(&$node, $form_state) {
global $user;
echo "JAIIIIIIIIIII";
var_dump("hola");
$form['metalinks'] = array(
'#type' => 'fieldset',
'#title' => t('Edita el nom del link'),
);
$form['metalinks']['edita'] = array(
'#type' => 'textfield',
'#title' => t('edita el link'),
'#default_value' => t()
);
Use the folowing code
Hi
Use the following code.
You have an error in page arguments.
Thanks
Thank you !!
First of all, thank you both for your time and your attention. I'm trying to run this script but i have the same error. The page doesn't appear !!! :S i don't know where is the error. i'm trying to resolve it !
Thank you !