By fuzzie on
I am trying to convert an old static site to drupal. So far, so good, except for the complex forms.
Here is an example:
http://deibler-insurance.com/node/34 is the form I would like to use instead of using the survey or contact module templates, like the other forms on the site are now. I just want to make them look a little cleaner, with drop downs for common things, etc.
Is it possible?
Comments
bump...
bump...
can anyone help with this? I can't seem to get it to submit.
Someone has to have already
Someone has to have already done this or know how to do it.
Or does everyone just use the form_mail and survey modules?
Drupal Version?
Which version of Drupal are you trying to make these forms for?
Cortext Communications
Drupal Themes & Modules
------------------------------------------
Drupal Specialists: Consulting, Development & Training
Robert Castelo, CTO
Code Positive
London, United Kingdom
----
4.6
4.6
I have the forms and survey modules working, I am just trying to make them look prettier.
Make sense?
Try this using a themed table
In 4.6 you need to create an array of form elements.
The following is an example 4-column table. Note the use of colspan if/when needed.
This isn't exactly spelled out in the docs. I learned by looking at other modules included with the Drupal distribution.
Thanks, that makes some
Thanks, that makes some sense.
What is a themed table though? I searched and could not find any reference to it.
I tried creating a static php page with that code, and got:
warning: Invalid argument supplied for foreach() in /home/grace/public_html/includes/common.inc on line 1263.
warning: Invalid argument supplied for foreach() in /home/grace/public_html/includes/tablesort.inc on line 160.
warning: Invalid argument supplied for foreach() in /home/grace/public_html/includes/tablesort.inc on line 198.
warning: Invalid argument supplied for foreach() in /home/grace/public_html/includes/theme.inc on line 639.
arrays not defined
Drupal is barfing because you haven't defined your own value arrays. $month and so on don't exist. Try the code using your own form elements.
Read up on Drupal themes. 'table' is just one built-in theme function, but you can create you're own. In fact, this is required for custom layouts. I'm currently learning this myself ("Damn it Jim, I'm a web developer, not a web designer!")
don't use table output theme
While the above syntax was fine for starters, I'm now in the process of converting all my custom module output to table-less 100% CSS.
That is where I want to head
That is where I want to head too.
I just can't seem to get these "pretty" forms to work.
I might have spoken too soon.
While using all CSS to output text (as when viewing a node) works as expected, trying the same with node forms (or any form for that matter) is nearly impossible because of the way Drupal insists on wrapping every form element with a div. I have been unsuccessful in getting nested divs to format properly.
To make matters worse there's the form_textfield justification problem. No matter what the 'size' attribute is set to, the field will stretch across the full length of the table column.
I know that 4.7 includes the form API (which may or may not solve these formatting dilemmas), but I find it unbelievable that this hasn't been more of an issue with users of 4.6.
This could possibly be my first AND last project using Drupal. I thought it would save me lots of time, but the trade off in dozens of lost hours trying to do the simpliest things is just not worth it.
Well, this form issue is ....
Well, this form issue is the only thing holding me up.
Other than that, it's working great.
What do other folks do with forms using Drupal?
If you change (not again), what will you go to?
crazy aunt in attic
Fuzzie, I offer several useful tips here when formatting forms with CSS.
Formatting complex forms with 4.6 (can't speak for 4.7) is one of Drupal's dirty little secrets.