Hello,
I would like to know how to make a form with some of the elements presented in tables.
I have read what's written here http://drupal.org/node/47582
But unfortunately it haven't helped me much since I get an error using the function drupal_render_form().
I've been trying to make it work with drupal_render() but without success so far.
I get errors like:
# warning: Illegal offset type
# warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback
# warning: htmlspecialchars()
What I'm trying to do is a number of radiobuttons and then a table with checkboxes and information and finally (of course) an submitbutton all integrated in on form.
Could somebody please tell me in a simple way how to make this work?
I have been trying forever now and it's getting annoying.
All answers appreciated!!
thank you!
Comments
It would help if you posted your code
It would help if you posted your code since it is pretty hard to guess what your code looks like.
Right now..
..my code for the function in question looks like this and it's far from working..
You have tried to mash everything in one function
You have tried to mash everything in one function and have 4.7 form calls but are using Drupal 5.0.
In Drupal 5 you need code that calls/invokes the form using drupal_get_form(), a function that declares the form fields and in your case another one to theme the form (to get the table layout). If you look at http://drupal.org/node/47582#comment-657822 it shows and example of the function that declares the form fields and the theme function (though I prefer the way you code builds the table than the way the example hardcodes the tags).
You may wish the read the Quick Start Guide for the forms API to learn more about using the forms API.
How to get the form-elements?
Thank you very much for taking time and trying to help me out here. It's appreciated I promise.
I've tried to changed my code now into two functions instead of one. The problem now is that I don't know how to get the access to the form-elements. The point having it all in one function was that I wanted to only call the database once. Since the number of rows and the number of checkboxes should be the same (one per row). Do I know need to call the database twice? I guess so.
If somebody could please tell me how to access the formelements and point out again what needs to be changed in my functions I would be very happy.