Adding new publications is not possible

teelmo - October 6, 2009 - 13:44
Project:Bibliography Module
Version:6.x-1.7
Component:User interface
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

I cannot create new biblio objects. I go to the page "/node/add/biblio" and select the publication type (for example Book). After that the view doens't give me any new options and not even a save button. (See attachment)

Existing biblio objects can be edited all right. This came up to me when I updated to Drupal 6.14. but I'm not sure if it is related to this problem.

This occurs at least with versions 6.x-1.6 and newer.

Sorry for the localized screenshot. It says on the top as error message: "Title field is compulsory". Page title is: "Create biblio content".

---------
For a smaller matter, there is an unclosed short tag in biblio.module on line ~1050
'#suffix' => '

AttachmentSize
attachment.png8.7 KB

#1

Frank Steiner - October 8, 2009 - 14:05
Title:Adding new biblio objects is not possible» Adding new publications is not possible

Confirmed. The problem is in the encoding. The code of the biblio form looks like this:

<select name="biblio_type" onchange="document.getElementById(&#039;node-form&#039;).submit()" ...

So there must be an additional step somewhere (likely in drupal 6.14) which transforms the single quotes into their html tags. I've no idea where it comes from, but it's real problem. We also cannot add any publications.

#2

rjerome - October 8, 2009 - 15:54

I don't think it's an issue with 6.14, since I'm running that on my production site and it works fine. Also, my test site is running 6.9 and it produces the same encoding as shown above.

I've tried it with both FF and IE browsers, what are you using?

#3

Frank Steiner - October 8, 2009 - 20:45

Firefox 2 and 3 and Opera 10, both Linux. I can however confirm that it happened without any change to biblio, I was still running the 1.1 version while only upgrading drupal itself from .12 to .13 to .14. I'm pretty sure it happened from .13 to .14 because we regularly enter new publications and we would have realized if it didn't work with drupal 6.13 already.

Very strange :-(

I don't fully understand the mechanism here: where's the submit function defined that is to be called by the onchange action? Should it biblio_form_submit or sth.? I only find the validate function for the form in biblio.module.

#4

rjerome - October 8, 2009 - 21:00

Strange indeed since it doesn't do it on my 6.14 installation. Are you using any caching?

That's a bit of a hack, it's basically clicking the submit ("Save") button when the user changes a publication type. In the validate code, it checks to see if the user has changed the "type" since the last time through, if not then it is submitted, otherwise the form is just rebuilt ( $form_state['rebuild'] = TRUE;) ...

    default:
      if ($form_state['storage']['biblio_type'] == $form_state['values']['biblio_type'] || (!empty($form['#node']->biblio_type) && $form['#node']->biblio_type == $form_state['values']['biblio_type'])) {
        $form_state['storage'] = array();
        $form_state['rebuild'] = FALSE;
      }
      else {
        $form_state['storage']['biblio_doi']   = TRUE;
        $form_state['storage']['biblio_paste'] = TRUE;
        $form_state['storage']['biblio_type']  = $form_state['values']['biblio_type'];
        $form_state['rebuild'] = TRUE;
        return;
      }

#5

Frank Steiner - October 9, 2009 - 06:42

No, any kind of caching is disabled. With some debugging messages I can see that the validate function comes into the rebuild case, but I've put a "print" and "drupal_set_message" into biblio_form. Those are printed when I enter the node/add/biblio page the first time, but it's not issued again when select a type.
Thus, it seems the form is not really rebuilt.

#6

Frank Steiner - October 9, 2009 - 06:52

Ok, it is a problem of 6.14. I just wonder why it does not happen for everyone. A patch for 6.14 that works for me is in http://drupal.org/node/591696
Discussions of this problem are in
http://drupal.org/node/587254
http://drupal.org/node/584536
http://drupal.org/node/302240

#7

rjerome - October 9, 2009 - 12:51

Thanks for tracking that down Frank.

Still not sure why I'm not seeing that on my installation, I'll have to check that core forms file and see if it has the changes mentioned above.

Ron.

#8

teelmo - October 22, 2009 - 07:44

Have you come up in any solutions. Even a hack or patch?

I tried to modify the code @ /biblio/biblio.module on line ~1450

      default:
      if ($form_state['storage']['biblio_type'] == $form_state['values']['biblio_type'] || (!empty($form['#node']->biblio_type) && $form['#node']->biblio_type == $form_state['values']['biblio_type'])) {
        $form_state['storage'] = array();
        $form_state['rebuild'] = FALSE;
      }
      else {
        $form_state['storage']['biblio_doi']   = TRUE;
        $form_state['storage']['biblio_paste'] = TRUE;
        $form_state['storage']['biblio_type']  = $form_state['values']['biblio_type'];
        $form_state['rebuild'] = TRUE;
        // There three lines are added locally for debugging
        echo '<pre>';
        print_r($form_state);
        echo '</pre>';
        return;
      }

But i didn't get any working results. All thought it seems that debug messages are printed from that else sector.

Array
(
    [storage] => Array
        (
            [biblio_doi] => 1
            [biblio_paste] => 1
            [biblio_type] => 100
        )

    [submitted] => 1
    [values] => Array
        (
            [nid] =>
            [vid] =>
            [uid] => 1
            [created] => 1256196769
            [type] => biblio
            [language] => fi
            [changed] =>
            [doi_data] =>
            [doi_submit] => Populate using DOI
            [paste_data] =>
            [paste_submit] => Populate using BibTex
            [biblio_type] => 100
            [form_build_id] => form-222c8bd201ca36e2365a0cfe906670f0
            [form_token] => a2f8e78cbd85ba0da63231834994a131
            [form_id] => biblio_node_form
            [title] =>
            [items] => Array
                (
                    [0] => Array
                        (
                            [id] =>
                            [in_circulation] => 0
                            [notes] =>
                        )

                )

            [library_more] => Add an Item
            [op] => Populate using DOI
        )

    [submit_handlers] =>
    [validate_handlers] =>
    [clicked_button] => Array
        (
            [#type] => submit
            [#disabled] => 1
            [#value] => Populate using DOI
            [#post] => Array
                (
                    [paste_data] =>
                    [biblio_type] => 100
                    [title] =>
                    [items] => Array
                        (
                            [0] => Array
                                (
                                    [notes] =>
                                    [id] =>
                                )

                        )
                    [changed] =>
                    [form_build_id] => form-222c8bd201ca36e2365a0cfe906670f0
                    [form_token] => a2f8e78cbd85ba0da63231834994a131
                    [form_id] => biblio_node_form
                )
            [#programmed] =>
            [#tree] =>
            [#parents] => Array
                (
                    [0] => doi_submit
                )
            [#array_parents] => Array
                (
                    [0] => doi_lookup
                    [1] => doi_submit
                )
            [#weight] => 0.002
            [#processed] =>
            [#description] =>
            [#attributes] => Array
                (
                    [disabled] => disabled
                )
            [#required] =>
            [#input] => 1
            [#name] => op
            [#button_type] => submit
            [#executes_submit_callback] => 1
            [#process] => Array
                (
                    [0] => form_expand_ahah
                )
            [#id] => edit-doi-submit
        )
    [rebuild] => 1
)

Any ideas ? I have none :)

#9

teelmo - October 22, 2009 - 13:15

I can also say that it doesn't work with Google Chrome either. I have also tried it with two different Linux servers and the functionality that it won't work appears on both.

And to make it clear I also noticed this when Drupal was upgraded from 6.13 to 6.14.

#10

rjerome - October 22, 2009 - 13:40

This is definitely a problem introduced in 6.14 see comment #6. It has to do with the fact that I'm using a technology called AHAH (Asychronous HTML and HTTP) on the form. Hopefully it will be resolved in 6.15.

Ron.

#11

Frank Steiner - October 30, 2009 - 14:17

The bug is marked a release-stopper for 6.15

 
 

Drupal is a registered trademark of Dries Buytaert.