By qasimchaudhry on
Hi,
I'm creating a module and have run across a problem I would appreciate some help with.
I have a form page and I would like to display a table at the top (showing information to help the user make their choice in the form).
I have used the theme('table', $header, $rows) method to create a table but I have no idea how to place that into the form (created via the 'drupal_get_form' callback).
Can someone please help my idoicy?
Thx
Comments
Thats very simple, use
Thats very simple, use hooke_all or hook_block.
function test_all() {
$header = array('this', 'is', 'my', 'test');
$rows[] = array('wow', 'it', 'works', 'great!');
$content = theme('table', $header, $rows);
return $content;
}
huge hug
Feijó
Have you looked at the '#description' instead?
Adding a description tag to each form field may be another way you can provide help in filling up the forms. To use this just add a
'#description'=>t('Help for the field')for every field that you would like to provide instructions with.Of course the other alternative is to include it in the form like so:
you solution is in themes
note that this is a very extract form.. u may need to modify or add few stuffs to make it working...
better take it as an example...
you can also put ur text fields, lets say "frm_field_2" inside a table cell (inside
$str_output .= "< td >".drupal_render($arr_form['frm_field_2'])."< /td >";
lemme know if its going above ur head... :-)
Thanks, that works wonders
Thanks, that works wonders
I tried the same thing - form fields in table - but
I tried the same thing and it work perfect as the fields comes in the table.
but for each field, I am getting a error message
# warning: implode() [function.implode]: Bad arguments. in d:\Websites\htdocs\includes\form.inc on line 618.
# warning: implode() [function.implode]: Bad arguments. in d:\Websites\htdocs\includes\form.inc on line 618.
# warning: implode() [function.implode]: Bad arguments. in d:\Websites\htdocs\includes\form.inc on line 618.
few lines of the code is
I am unable to figure out why i am getting this error, also the
tag is not creating and submit button is not working.
Can any one help me in this ?
Regards, and Have a nice day.
Prachait Saxena
---------------------------
(M) :- +91 9953 200 299
(E) :- info (at) prachait (dot) com
(W) :- http://www.Prachait.Com/
your form definition
your form definition function and theming function need to be separated out.
put the first part of the function above: where you define the $form[..] = fields into its own function
The second part with the table put in a different function it has to be called:
drupal form in table - still have the issue
hi panis, thanks for the help,
I did the changes as you said, but still the same error,
I am not able to figure out, the issues
the changes are
Called on some page from menu :
Function for creating the table theme
I check the HTML output, and got the followings
1. The
is not geting generated
2. the elements name="" is coming blank
Regards, and Have a nice day.
Prachait Saxena
---------------------------
(M) :- +91 9953 200 299
(E) :- info (at) prachait (dot) com
(W) :- http://www.Prachait.Com/
you still have a similar error in your code.
in your menu function - do not call the theme function directly.
Call:
$output .= drupal_get_form('hms_information_horse_search');
This will automatically call the theme function and do the submit etc..
form in table, working fine now
Hi,
I made the said changes,
1. The form submit is working fine
2. The elements name is coming
3. All the error are removed, but now a new error is coming
BUT:
1. New error :
warning: Missing argument 2 for theme_hms_information_horse_search() in d:\Websites\htdocs\modules\hms\hms_horse\hms_horse.module on line 1710.
i rectified the above error by changing
2. The FORM is not coming in the TABLE now,
Now First the table appear then the form block with all the elements one below other.
Rectification :
Comment this line
Now it is working fine, the form is coming in the table and submit button is also working.
Thanks for the kind support.
Regards, and Have a nice day.
Prachait Saxena
---------------------------
(M) :- +91 9953 200 299
(E) :- info (at) prachait (dot) com
(W) :- http://www.Prachait.Com/