RSS

|| drupal 7 || tutorial || popup with html form

20 Oct

In drupal 7, once i have to show a comment form in the popup. I used the greybox jQuery plugin to show a drupal comment form in popup and find that the whole page along with the interface get called in the popup whereas i just need to show the form only. I was suggested to call a html page having only the html form to be displayed in the popup window. As far as interface is concerned, its ok with the comment form in the popup but how to manage the html form action in drupal. i have to specify some redirection url in html form action=”” but what exactly?

hook_menu is there to introduce new urls as

function mymodule_menu() { //{moduleName}_menu

$items['custom_page'] = array( 
// {baseurl}/custom_page will be the url

'page callback' =>'html_form_action',
//function to be called by {baseurl}/custom_page

'access callback' => TRUE,

'type' => MENU_NORMAL_ITEM,

);

return $items;

}

function html_form_action() {

global $base_url;

//form action handling here

drupal_goto($base_url."/sites/all/modules/mymodule
/comment.php",array('query'=>array('status'=>$status))); 
// redirection to html form page to handle the 
//appropriate form action response

}

and in html

 <form action="{baseurl}/custom_page" …>

That’s it 🙂

Note: If you find that under the Navigation block there is a bullet without any title, then this is due to the menu we have created. For hiding that unnecessary bullet goto {base_url}/admin/structure/menu/manage/navigation and disable the unwanted bullet.

Advertisements
 
3 Comments

Posted by on October 20, 2011 in drupal

 

Tags: , , , , , , ,

3 responses to “|| drupal 7 || tutorial || popup with html form

  1. Cazare Revelion Munte

    June 16, 2014 at 10:54 pm

    Hotel Bucuresti Unirii

    Right here is the perfect webpage for anyone who would like to understand this topic.

    You understand so much its almost tough to argue with you (not that I personally
    will need to…HaHa). You certainly put a new spin on a
    topic that’s been written about for ages. Excellent
    stuff, just wonderful!

     
  2. Hoteluri

    July 30, 2014 at 2:50 pm

    We stumbled over here different web page and thought I may
    as well check things out. I like what I see so i am
    just following you. Look forward to exploring your web page again.

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: