Hi starbow!

At first, thanks for your little but powerful popup module :-)

But ... I'm currently struggled with noReload parameter. I need to launch popup form and after I submit the form I need NOT to reload the original page.

I look at noReload parameter in the readme file:
"noReload: Does the popup NOT modify the original page (Default: FALSE). "

When I have some $form_state[redirect] defined, page content area is reloaded every time - with noReload true or false, doesn't matter (or with popup, popup-form classes). Only difference is: popup (noReload = True) reloads whole page, popup-form (noReload = False) reloads content area, popups-form-reload {reloadWhenDone: true} reloads whole page in such way that i.e. status messages which appears in both previous cases in this case appears not.

Only way which don't reload original page is not set $form_state[redirect] paramater. Then I cycling (as I supposed) in popup form round and round... but it refreshes only the popup area and after clicking on "Close", original page left unchanged - so it's something what I want, but it isn't nice.

I've also tried some combination with other popup options, but with no success.

Am I missing something?

Wojtha

EXAMPLE of my test code:


function test_form(&$form_state,$nid = 18) {
  $form = array();
  $form['submit'] = array(
      '#type' => 'submit',
      '#value' => 'Submit',
      );
  $form['nid'] = array(
      '#type' => 'hidden',
      '#value' => $nid,
      );
  return $form;
}

function test_form_submit($form, &$form_state) {
  drupal_set_message('Node nid: '.$form_state['values']['nid'].' was added '.time());
  $form_state['redirect'] = 'test/popups';
}

function test_popups_page() {
  popups_add_popups();

  $output = '';

  $output .= format_date(time()) . ' | ' . time() . '<br />';
  $output .= '<b>TEST-FORMS:</b><br />';
  $output .= l("single form POPUPS.", 'test/test_form',
               array('attributes' => array('class' => 'popups'))) . '<br />';
  $output .= l("single form POPUPS QUERY.", 'test/test_form',
               array('attributes' => array('class' => 'popups'), 'query' => array('destination' => 'test/popups'),)) . '<br />';
  $output .= l("single form POPUPS-FORM.", 'test/test_form',
               array('attributes' => array('class' => 'popups-form'))) . '<br />';
  $output .= l("single form POPUPS-FORM-RELOAD.", 'test/test_form',
               array('attributes' => array('class' => 'popups-form-reload'))) . '<br />';
  $output .= l("single form POPUPS-FORM QUERY.", 'test/test_form',
               array('attributes' => array('class' => 'popups-form'), 'query' => array('destination' => 'test/popups'),)) . '<br />';
  $output .= l("single form #MYID", 'test/test_form',
               array('attributes' => array('id' => 'myid'))) . '<br />';
  popups_add_popups(array(
      '#myid' => array(
          'noReload' => FALSE,
          'forceReturn' => 'test/test_form',
  )));
  
  return $output;
}

Comments

wojtha’s picture

Category: bug » feature

Well I went throught the popups.js code and it seems, that {noReload: false} means only "Use ajax request and change content area after succesful submit" not don't touch original page as I supposed. So I have made my own custom option parameter "unTouchable" and put the additional condition to Drupal.popups.formSuccess. If unTouchable is true it lefts content without modifications...

It seems it is working as I want now.

Can you add some kind of this parameter to the Popups? I think it will be usable in some use cases.

Thanks
Wojtha

starbow’s picture

You are right. It is currently always assumed that if you have a form, you will want to reload the page, and noReload=TRUE does not prevent it. It probably should, now that there is a separate reloadWhenDone option.
I have to think if this change might break user's current setups.

starbow’s picture

Category: feature » bug
Status: Active » Fixed

Ok, I declare this a bug. It has been fixed in rc6. noReload=TRUE now works as one would assume it should.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.