Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Draw attention by rpayanm
Bounty Started worth 50 reputation by rpayanm
added 83 characters in body
Source Link
rpayanm
  • 3.7k
  • 4
  • 31
  • 51

I have a form:

//... $form['submit'] = array( '#type' => 'submit', '#value' => t('Sumbit'), ); 

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array( 'title' => 'Thank you', 'page arguments' => array(1), 'access callback' => TRUE, 'page callback' => 'thankyou_callback', 'type' => MENU_CALLBACK, ); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); 

The callback function:

function thankyou_callback($js = NULL) { // Content that we place in the popup. $popup_content = t('Thank you!'); if (!$js) { return $popup_content; } ctools_include('modal'); ctools_include('ajax'); $output = array(); $output[] = ctools_modal_command_display(t('Greetings'), $popup_content); print ajax_render($output); drupal_exit(); } 

My form submit:

function myform_submit($form, &$form_state) { // ... // show my modal here modal.show(); // ??? } 

Then, How I show a ctools modal after form submit?

Please, with not ajax callback.

I have a form:

//... $form['submit'] = array( '#type' => 'submit', '#value' => t('Sumbit'), ); 

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array( 'title' => 'Thank you', 'page arguments' => array(1), 'access callback' => TRUE, 'page callback' => 'thankyou_callback', 'type' => MENU_CALLBACK, ); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); 

The callback function:

function thankyou_callback($js = NULL) { // Content that we place in the popup. $popup_content = t('Thank you!'); if (!$js) { return $popup_content; } ctools_include('modal'); ctools_include('ajax'); $output = array(); $output[] = ctools_modal_command_display(t('Greetings'), $popup_content); print ajax_render($output); drupal_exit(); } 

My form submit:

function myform_submit($form, &$form_state) { // ... // show my modal here modal.show(); // ??? } 

I have a form:

//... $form['submit'] = array( '#type' => 'submit', '#value' => t('Sumbit'), ); 

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array( 'title' => 'Thank you', 'page arguments' => array(1), 'access callback' => TRUE, 'page callback' => 'thankyou_callback', 'type' => MENU_CALLBACK, ); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); 

The callback function:

function thankyou_callback($js = NULL) { // Content that we place in the popup. $popup_content = t('Thank you!'); if (!$js) { return $popup_content; } ctools_include('modal'); ctools_include('ajax'); $output = array(); $output[] = ctools_modal_command_display(t('Greetings'), $popup_content); print ajax_render($output); drupal_exit(); } 

My form submit:

function myform_submit($form, &$form_state) { // ... // show my modal here modal.show(); // ??? } 

Then, How I show a ctools modal after form submit?

Please, with not ajax callback.

added 29 characters in body
Source Link
rpayanm
  • 3.7k
  • 4
  • 31
  • 51

I have a form:

//... $form['submit'] = array( '#type' => 'submit', '#value' => t('Sumbit'), ); 

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array( 'title' => 'Thank you', 'page arguments' => array(1), 'access callback' => TRUE, 'page callback' => 'thankyou_callback', 'type' => MENU_CALLBACK, ); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); 

The callback function:

function thankyou_callback($js = NULL) { // Content that we place in the popup. $popup_content = t('Thank you!'); if (!$js) { return $popup_content; } ctools_include('modal'); ctools_include('ajax'); $output = array(); $output[] = ctools_modal_command_display(t('Greetings'), $popup_content); print ajax_render($output); drupal_exit(); } 

My form submit:

function myform_submit($form, &$form_state) { // ... // show my modal here  modal.show(); // ??? } 

I have a form:

//... $form['submit'] = array( '#type' => 'submit', '#value' => t('Sumbit'), ); 

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array( 'title' => 'Thank you', 'page arguments' => array(1), 'access callback' => TRUE, 'page callback' => 'thankyou_callback', 'type' => MENU_CALLBACK, ); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); 

The callback function:

function thankyou_callback($js = NULL) { // Content that we place in the popup. $popup_content = t('Thank you!'); if (!$js) { return $popup_content; } ctools_include('modal'); ctools_include('ajax'); $output = array(); $output[] = ctools_modal_command_display(t('Greetings'), $popup_content); print ajax_render($output); drupal_exit(); } 

My form submit:

function myform_submit($form, &$form_state) { // ... // show my modal here } 

I have a form:

//... $form['submit'] = array( '#type' => 'submit', '#value' => t('Sumbit'), ); 

I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array( 'title' => 'Thank you', 'page arguments' => array(1), 'access callback' => TRUE, 'page callback' => 'thankyou_callback', 'type' => MENU_CALLBACK, ); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); 

The callback function:

function thankyou_callback($js = NULL) { // Content that we place in the popup. $popup_content = t('Thank you!'); if (!$js) { return $popup_content; } ctools_include('modal'); ctools_include('ajax'); $output = array(); $output[] = ctools_modal_command_display(t('Greetings'), $popup_content); print ajax_render($output); drupal_exit(); } 

My form submit:

function myform_submit($form, &$form_state) { // ... // show my modal here  modal.show(); // ??? }