Hi!
I'm building a module in witch AJAX needs to post some additional data from the form.
My question is:

  1. Should I use the form generation functions to generete a form, that will not send any data to the page and will only be used by javascrit
  2. How can I prevent the form to be submited
  3. Can I insert the form as a static HTML (print it out on the page)

thank you for all your help!

Comments

sunnydeveloper’s picture

"needs to post some additional data from the form"

"How can I prevent the form to be submited"

what are your steps here? You can add javascript to the drupal header in your module.

Can I insert the form as a static HTML - insert a form where?

Trying to understand - thanks

fuzzy’s picture

This module's page displays a tree structure, feched with AJAX, much like jQuery File Tree. But I watn to send additional data (like filetype/extention or date of creation) to the server side connector script. This data is gathered from a couple of <input> elements, a form. This form should not be submited as a regular form would be, insted it shuld only serve as an user interface to the data, the javascript/jquery will use (in it's ajax post).

so I could set up the form as a static HTML from my "build this module's site" function and send it (as a string) to hook_menu → item → 'type' => MENU_NORMAL_ITEM → 'page callback' => "-------this-site-and-the-form-on-it-------"
but I am thinking this is not the best solution.

or

I could use form generation functions, wich would produce a form with submit button, reset button, form handlers and so on. This is what I don't want.

thanks for your effort!