How do I format results from form Api?

Events happening in the community are now at Drupal community events on www.drupal.org.
PixelClever's picture

I just built my first module today. It is inanely simple, but it works. I created two fields that the user fills in, and using the values from those fields I made it do a simple calculation. Now I'm trying to figure out how to take the results from those calculations and control the output a bit more. The only way that I have found to print the results from a form in drupal is with drupal_print_message. This works for single result equations, but later I need to be able to end up with multiple results and do more advanced formatting with tables or unordered list. I have seen this done in regular php through for loops, but I don't really understand how to go from the submit function and pass the results on to a another function that will calculate and format the results. Can anyone give me any pointers?

I based my module on the module demo on page 154 of "Pro Drupal Development."

Comments

Ajax

splacette's picture

Have you thought about displaying the results dynamically using Ajax? Then you wouldn't have to wait for the page load to see the results. If you'd like to implement some ajax I can help you out with examples and references.

Sam

Austin

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week