Search This Blog

May 19, 2011

Contact Form Module for Drupal - Last

Next is the contact-block.tpl.php file. This is where you display the contact form.

<?php

<div id="contact-container">
 <h1>Leave Us a Message</h1>
 <div id="form-container">
   <?php print $contact_form; ?>
   <div id="contact-message"></div>
 </div>
</div>

<?php print $contact_form; ?> - as you can see, we call the $contact_form variable to display the form that we created in the module file.

The last two files are the css and the js file which add style and clear fields functionality in your contact form.

contact.css

#contact-container{
margin:20px auto;
width:463px;
background:#f8f0e7;
}
#contact-container h1{
font-size:18px;
padding:12px 25px;
}
#form-container{
padding:0px 25px 20px;
}
#contact-message{
margin-top:5px;
color:#B76600;
}
#contact-form .form-item label{
float:left;
margin-top:6px;
font-weight:normal;
width:73px;
}
#edit-message-wrapper label{
margin-right: 6px;
}
.grippie{
width:317px;
}
#contact-form .form-radios{
width: 450px; 
margin-top: 0px; 
margin-bottom: 0px;
}
#contact-form  #edit-submit{
padding-top:3px;
}
#contact-form .resizable-textarea{
width:317px;
margin-left:79px;
}


contact.js

Drupal.behaviors.contact = function(context) {
if ($("#contact-message div div").hasClass("status")){
$("#edit-name,#edit-email,#edit-subject, textarea").val(""); 
}
}

Thanks for reading. Here is the download link of contact form module.

2 comments:

Jitendra said...

thnx for nice work
and pretty simple example but
where can i see the form i m not able to see the dorm created by module??

sbobet said...

sbothnx for nice work
and pretty simple example but
where can i see the form i m not able to see the dorm created by module??livescore