How can i create a sliding/slideout block for my contact module

2 replies [Last post]
Last seen: 10 years 46 weeks ago
Joined: 2011-05-04

Hi everyone. I am in the concluding stage of building a theme and I am in a dilemma of how to implement the contact form that appears on the right side on every node on my website just like the feedback form on the build a module website, the difference now is that instead of it popping out it slides out instead.

here is my first approach, to use the existing forward and contact module and turn it into a block module. I have successfully turned the module into a block but i don't know how i am gonna turn it into a sliding block. the trickiest part is that my site has different colour codes for each menu you are on at a point in time and I will also need the block to inherit the colour code of the node it appears on. The other option i am considering is to add the form as pure HTML to my drupal template and then write a PHP script to execute the form validation. This approach seems easier but then i dont think it is right coding practice. I have not done this yet but I will like to exhaust all option there is in using the Drupal module before resulting to the second option.

I will really appreciate any help at all. thanks in advance :)

I forgot to mention that I am building a drupal 7 theme.

Last seen: 10 years 21 weeks ago
Joined: 2011-06-04
Try using jQuery

The jQuery UI is a standard part of Drupal 7, or at least available as a module. Check out the API documentation as it offers all sorts of different effects including a 'slide-in'/'slide-out' transition. Chris' videos on implementing jQuery were very helpful.

jQuery documentation is available at:

Chris Shattuck
Last seen: 9 weeks 5 days ago
Joined: 2009-08-16
This sounds like a fun

This sounds like a fun feature. :)

Bill's comment is spot-on for getting the sliding feature working. The other question you had was the best way to create the form. You definitely shouldn't have to build your own form for this. If you find yourself building forms in HTML and PHP on a Drupal site, then there's a better way. :)

What you can do is first, figure out the form ID of the form you want to embed. You can learn more about how to find this on the hook_form_alter() video. Then, you can pass the id on to drupal_get_form() to render the form. That's all you need to pull in any Drupal form. This goes for the Contact module, or if you need something more customized, the Webform module.

Once you have the form, you can either put the PHP code in a custom block, you can add a new block via a custom module, or you embed it some other way in a template file.

Let me know if this helps.


Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:

Contact us

Below are the supported keyboard shortcuts for our video player.

Start / stop video
Go to next video
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
Jump to a percentage (2 is 20%, for example)
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
1 month
6 months
10% off
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.