By kuldeepkaundal on
Hi,
Please look at following code:
function mymodule_menu() {
$items = array();
$items['user/register/%'] = array
(
'page callback' => 'drupal_get_form',
'page arguments' => array('mymodule_user_register'),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function mymodule_user_register(&$form_state, $doctor) {
$form['email'] = array(
'#type' => 'textfield',
'#title' => '',
'#size' => '20',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Subscribe',
);
return $form;
}
The issue is that this hook is not returning any form.
Please tell me what i am doing wrong here.
Regards,
Kuldeep.
Comments
It appears you are trying to
It appears you are trying to override the path used for registration which I believe will fail because the path is in use.
Well, he's registering a
Well, he's registering a sub-path, so it looks like it should be fine.
Kuldeep - what path are you accessing?
Contact me to contract me for D7 -> D10/11 migrations.
Well my path is
Well my path is user/register/certain_code
like:
user/register/10003445
It could be because this
It could be because this declaration
says the function expects a second argument ($doctor) but none is passed in and is likely to cause an error.
Good point. To fix that,
Good point. To fix that, this:
Should be changed to this:
Contact me to contract me for D7 -> D10/11 migrations.
Thanks for reply, but, i
Thanks for reply, but, i don't really need any parameters, so, even if i write this:
function mymodule_user_register(){
form code
}
I still can't see any form!
You have told the function to
You have told the function to expect a variable called $doctor, and you aren't sending the function that variable. This will cause you problems. You can call it anywhere, but as long as you don't pass it $doctor, it's not going to work.
Contact me to contract me for D7 -> D10/11 migrations.
Ok, the form is working on
Ok, the form is working on default drupal installation, since i am trying to add this form on a drupal website already built, it must be related to some configuration on that website, can someone please suggest me what that can be?
Yes, it's that you aren't
Yes, it's that you aren't passing the $doctor variable to your form.
Contact me to contract me for D7 -> D10/11 migrations.
Oh, comeon, i already told,
Oh, comeon, i already told, same thing is working in default drupal installatio, with no changes required, its only this website that is already setup and i need to add this form is not showing form, i guess its a configuration issue now not related to coding, since same code works on other default installation.
Yes, as per ur suggestion, i removed $doctor and changes the function to:
function web_service_registration_form() {
}
Any suggestions?
Have you cleared your caches
Have you cleared your caches since you changed the function name? The menu router table will need to be rebuilt with the new function name