Support adding Biblio nodes

Benjamin Melançon - January 2, 2009 - 00:41
Project:Popups: Add and Reference
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

The Biblio module uses a multi-step form for adding Biblio nodes. (First the Publication type is chosen from a drop-down select element, and then a form specific to that type loads.)

Do you see any way for Popups Add and Reference to support this? Could it make successive AJAX queries, intercepting or "boxing in" Biblio's form submission inspired page refresh?

Thanks.

We are interested in funding development of this feature.

benjamin, Agaric Design Collective

#1

starbow - January 5, 2009 - 17:34

Should be doable. Drop me a private message and we'll work out the details.

#2

starbow - January 11, 2009 - 20:06
Title:Support Multiple Step Forms (for adding nodes of complex types) in the pop-up dialog box» Support adding Biblio nodes
Status:active» fixed

Turns out this is pretty much entirely on the biblio side. They are using an onchange hook to submit their form, which does not give the jQuery form plugin a chance to do it's thing. I will provide you with a small module that form_alters biblio and allows the two modules to work together, but I don't think it is effects enough people to bake it into this module.

#3

System Message - January 25, 2009 - 20:10
Status:fixed» closed

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

#4

kehan - July 23, 2009 - 15:20

Hi,
I've got this issue with the drupal 5 branch - I'm happy to add the form_alter into one of my modules but I'd appreciate it if you could post the code of your little module up somewhere?

#5

starbow - December 5, 2009 - 01:20

I keep getting asked about this, so here is the code that worked back in January. I don't know if it still works:

/**
* Implementation of hook_form_alter().
*/
function popups_biblio_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && $form['type']['#value'] == 'biblio') { 
    // Get rid of the onchange submit handler, b/c it kills ajax_submit.
    unset($form['biblio_type']['#attributes']['onchange']);
    // Add in a submit button where appropriate.
    $node = $form['#node'];  
    $form_state_tid = $form_state['post']['biblio_type'] ? $form_state['post']['biblio_type'] : $form_state['values']['biblio_type'];
    $tid = (!empty($form_state_tid)) ? $form_state_tid : $node->biblio_type;
    if (empty($node->nid) && !$tid) {
      $form['submit'] = array( '#type' => 'submit', '#value' => "Pick Type" );
    }
  }
}

#6

kb_0 - December 5, 2009 - 06:30

That works just fine. Thank you very much.

 
 

Drupal is a registered trademark of Dries Buytaert.