I am developing a module which is started by the uses clicking a link under a node. I would like to enhance the module by adding a text box next to link so the user can submit some information.

How would i do this?

Comments

pembeci’s picture

You have to use the Form API. It may be too much to learn for such a simple task as you want but that's the best way of doing it. You may find some workarounds without using the Form API but they would also require extra work to make them merge with how Drupal works. Additionally, if you use the Form API you can extend the functionality more easily in the future. Are you sure you can't achieve what you need without existing features like free tags? With free tags you also enable users to associate some information with a node through an input box.

timmillwood’s picture

I know about form API, i have used it for the admin page etc, but need to know how to attach it do the bottom of a node like I have with a link.

pembeci’s picture

After defining your form, you need to call drupal_get_form function. Just print what this function returns and you get your form.

dipen chaudhary’s picture

a little more information will help us help you better, Something like what does your module do, 2 lines about the workflow of your module ..
So if you want help, then atleast explain your problem sufficiently

thanks
--------------------------------------------------------
Dipen Chaudhary
www.dipenchaudhary.com

--------------------------------------------------------
Dipen Chaudhary
www.qed42.com ( Drupal development services specialize in social networks and other user generated content platforms )
www.dipenchaudhary.com

timmillwood’s picture

The module is to merge pages from PDFs into one PDF.

The PDFs will be attached to nodes, and the form is wanted to select page numbers in the format "1,3-5,10" before clicking the add to pack button.

One all the files and page numbers have been added to a cart, the pack can then be downloaded.

timmillwood’s picture

I am starting to think this has to be done using the hook_view() function, but i need some more research.

It would be great if anyone can help with the research.

IB Community Theme http://communitytheme.ibo.org
Millwood Online http://www.millwoodonline.co.uk

danielb’s picture

yeah create all the functions for your form (to create the fields, validate, process submission), then in hook_view call drupal_get_form(form_function) and append it to the node there somehow

timmillwood’s picture

I am going all guns blazing and creating a content type, which seems to be a more sensible option. I hope then I can add my text field to the node then!

IB Community Theme http://communitytheme.ibo.org
Millwood Online http://www.millwoodonline.co.uk