How can i create a sliding/slideout block for my contact module
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.
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.
Cheers!
Chris
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: http://api.jquery.com/category/effects/