Not all data is saved when clicking Add Item or Save Changes

I'm a bit dismayed that I can't find any previous post about a problem we're having--one that we've now experienced on two different servers. Are we really the only ones running into it? Yipes....

When we create a new item (Add Item) or edit an existing item (Save Changes) there's a good chance that only some of the data we've entered will be saved.

Specifically, the Bibliographic Citation field is routinely (though idiosyncratically as far as we can tell) not saved. It's so common that our interns now copy the data in the Biblio Citation field before clicking on Add or Save so that when they have to try it again, they can just paste it in.

As far as we can tell, this is the only field that suffers from this problem. Has anyone else seen this? And does anyone have a solution?

ken.

UPDATE: I believe I've figured out the problem, though not the cure.

Whether or not you are editing an existing record or adding a new one, if you have need to click the Add Input button on any of the fields (e.g., to add a second author, editor, publisher or what have you), it pushes the data in the Bibliographic Citation field farther down in the element set (and maybe other fields too that I just haven't tried)out of the mysql INSERT/UPDATE commands.

I haven't looked at the code for this--not sure where to start--but I suspect one of the devs could find and fix this quickly.

It might also be handy if someone else could confirm this bug on another Omeka installation.

Relevant Info:
System
Omeka: 1.5.1
PHP: 5.2.17 (cgi)
OS: Linux 2.6.9-89.0.19.ELsmp i686
MySQL Server: 5.1.62
MySQL Client: 5.1.62

ken.

Just reread the last message and a typo makes it a bit unclear.

The simple version: Adding additional data by using an Add Input button anywhere on the Add or Edit pages results in (I believe) that extra data pushing the data in the Bibliographic Citation field (actually, probably just the reference to the Bibliographic Citation field itself) out of the final Insert or Update command that gets sent to the mysql server.

ken.

What element set or item type is the Bibliographic Citation element part of? Is this an element added by Dublin Core Extended?

I should add, following your instructions on Omeka 1.5.1 with Dublin Core Extended installed, I can't reproduce the problem you're describing.

Starting from a new item, can you come up with a concrete set of steps that causes this to happen?

Will do. Bibliographic Citation is part of Dublin Core Extended.

01. Click "Add an Item" button from admin>Items page.

02. Fill in a Title, Creator, Publisher, Medium, and Language

03. Fill in Format as Book (hardcover).

04. Click "Add Input" button for Format to add a second field. Add Book (softcover).

05. In Bibliographic Citation, click the HTML check box, then put in the following (text is irrelevant--this is just for your convenience): Bogost, Ian. Unit Operations: An Approach to Videogame Criticism. Cambridge: MIT Press, 2006. Print.

06. Click Add Item.

07. Review the entry to see if the bibliographic citation actually got saved. Chances are excellent (here at least) that some or all of the text will be missing. (When I did it just now, only "Bogost, Ian." got saved.

08. Edit that entry to correct the missing data and click Save Changes. Now when you review the entry, it will be fine.

09. Edit the entry again, this time adding a second publisher (Add Input).

10. Add some additional info to the end of the Bibliographic Citation, maybe something like "Two copies." and click Save Changes.

11. Review the entry. The second published will have been saved, but the extra stuff you put at the end of the Bibliographic Citation will probably be incomplete or missing.

I just did the exact process above and the missing data happened exactly as I described--even though I wrote these instructions before trying it. That's how predictable this error is (contrary to what I wrote in my first message).

Thanks again, John. I promise to quit pestering you soon.

ken.

Okay, I was able to reproduce the problem this time. Thank you for the detailed instructions.

I've been able to reduce the steps a little bit more, and as a result I don't think there's anything specifically about the Bibliographic Citation element to blame.

It looks like what happens is that you lose the text from an element if you turn on the HTML editor for that field after you've added an input to another field.

Some bad interaction between the JavaScript stuff going on with that form is likely the problem here: it seems the TinyMCE editor just isn't inserting the text like it should when the form gets submitted.

Ah, I see. So you think it's not about the Add Input but rather is about the HTML switch?

A quick test suggests that this is true; things entered with Add Input have no impact on the stuff in Bibliographic Citation...until I click on the HTML box.

Got an idea about how tough this is to resolve? I'm no champion coder, but if you don't have time to figure it out right now I'd be happy to take whatever starting points you can provide me and see if I can figure it out.

Thanks for helping me troubleshoot this. Getting it solved will really decrease our input time!

ken.

I'm pretty sure I've got a fix for this problem worked out.

Would you be comfortable trying to apply a patch? The patch containing the necessary changes from Omeka 1.5.1 is up on GitHub [link removed].

You could save that patch and then apply it through the shell by cding to the top-level Omeka directory, and then running:

patch -p1 < the_patch_file.patch

In my testing, this patch fixes the problem you described. If you do try out the patch, make sure to refresh the Add/Edit page or clear your browser cache before you try editing again, to make sure you're seeing the new code.

I'd be happy to give this a burn, but I'm on a hosted server and don't have shell access. Can I drop the code into a php file and execute it that way?

ken.

Okay then, now that I think about it, it'll be easier for you to just grab the new versions of the two changed files and FTP them into place, replacing the old ones.

The first changed file is admin/themes/default/items/form.php, and the updated version is here [link removed].

The second changed file is admin/themes/default/javascripts/items.js, and the updated version is here [link removed].

Well, it's closer. It saved the complete Bibliographic Citation, even after using the Add Input on the Creator field. Hooray!

What it didn't do is save the HTML formatting, in particular the italics (<em> & </em> presumably) on the book title.

I then went back into the item record, added a second Language entry (using Add Input), and fixed the italics. Hit Save Changes. The second language saved, but the italics disappeared again.

I then edited the record again just to add the italics, hit Save Changes, and this time the italics saved.

So close....

I definitely owe you a beer.

ken.

Now that I can't reproduce, even when following your long instructions from before.

Any formatting I apply with the HTML editor gets saved correctly.

(If you didn't see my edited comment above, check it out.)

I just refreshed everything, flushed my cache, and retried same thing--everything saved except the italics. Plus, the buttons for TinyMCE disappeared. I clicked on the Use HTML check box to uncheck it, then clicked on it again to put the check mark back, and bingo they reappeared.

I fixed the italics, saved, and checked to see that it had saved--it did.

Then from the Items list I clicked on the same entry again to go back in to edit it. I scrolled down to look at the Bibliographic Citation and discovered that everything looked fine in the entry except that the Tiny MCE buttons were missing again and I was seeing the raw HTML in the box, not the processed text (i.e., no italics, just the actual HTML and code surrounding the title).

hmmmm.....

ken.

** UPDATE **

I ordinarily work in Chrome, but I just retried to add an item with IE. This time the italics saved along with everything else, BUT when I edited the item, the TinyMCE buttons were again missing and the Biblio Citation was again in raw HTML. The Use HTML check box was still checked.

I do see the problem where the TinyMCE boxes aren't coming up automatically when the box is checked. That's probably a problem introduced by the fix, I'll look into it.

Thanks for helping out with this.

Thank YOU. I'll be away from the computer for a bit but will check back in later tonight. No worries if you can't work on this until some other time.

I wonder what's up with the Chrome vs. IE difference.

ken.

Updated (hopefully for the final time) versions of those time two files are up on Github:

admin/themes/default/items/form.php [link removed]

admin/themes/default/javascripts/items.js [link removed]

Same advice applies: reload, clear cache, etc.

Well, it's a different result at least.

Now, the TinyMCE buttons don't appear ever (not even when you uncheck and recheck the Use HTML box), and when you click on an Add Input button to put in a second publisher, creator, or what-have-you, it behaves like the Add Item or Save Changes button. That's right: it doesn't in fact give you another line to add input, but instead boots you back out to the Browse Items list and give you the green message that the item has been successfully saved. Strange behavior for the Add Input button....

Confirmed on both Chrome and IE (Windows 7), with cookies and caches cleared.

Don't kill the messenger....

ken.

PS: It's strange that you're not seeing these errors on your end--what OS and browser are you running?

Whoops!

I gave the wrong link for the items.js file in that last post. The one you want is here [link removed] instead.

You rock. Everything now working perfectly, John.

Send me a note at mesmer8ATgmailDOTcom and I'll get that much deserved beer sent right over.

Cheers!

ken.

Omeka 1.5.2 contains the "official" fix for this problem.

Big thanks, both for reporting the issue, and for trying out the updated code.