Semantic error programming drupal 6 module

I have to write a simple module (do not use WebForms) that form the form for receiving data. But my elements of my form did not show. I am using a drupal 6.0 document, but I do not know what is wrong!

this is the link of my source code.

I get the error msg: warning: Argument 2 for registration_register_form () is missing in /var/www/drupal/sites/all/modules/registeration/registration.module on line 29.

But I am writing the right arguments.

+4
source share
1 answer

You do not need to pass $form and $form_state in most * forms.

Try the following:

 function registration_register_form(){ 

instead:

function registration_register_form ($ form, & $ form_state) {

Background: drupal_get_form passes any given parameters to registration_register_form() , but you do not pass any additional arguments to registration_all() . (Only form function callback).

Note that you still need to pass $form and $form_state to the submit function, since registration_register_form_submit() uses the data of $ form_state.

* in most cases: if your form is a multi-stage form and the form changes to the values โ€‹โ€‹of the variables $form_state , which is a good use case that you need to pass $ form and $ form_state to registration_register_form()

Update After checking the code, I found many errors. See New Edition: http://pastebin.com/VNa3veFR (not listed) I fixed most of the problems that I could notice. See Inline comments and comments on function names.

+1
source

Source: https://habr.com/ru/post/1440829/


All Articles