Hi all.

I have a problem with cck field when I put "Unlimited" in "Number of values". I have a custom node form with its template, and with some extra functionality from javascript. When the form loads, everything works ok, I have my two fields really to fill, but when I click "Add another item" to add a thrid field, all the extra functionality it's gone, and also all the form loses all the javascript addon.

Any idea why this happens?

Thanks.

Comments

yched’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Hard to tell without more information on what your script does.
The 'add more' button works ok with other JS behaviors on the page (drag-ndrop, collapsible fieldsets...)

My best bet would be that your JS code does not use the Drupal.behaviors.attach() method to attach itself to the page.

escuriola’s picture

Ok, I will report two common problems:

- In my custom template.php function to theme the form, I've translated "Add another item" to "Añadir otro elemento" (spanish). When I click in the button, the translation dissapears and comes back to "Add another item"

- I have the module "Textfield to slider" which creates an slider bar from a combo box. When the forms loads for first time, works ok, the sliders appears and works fine, but when I click in "Add another item" the slider bar dissapears an combes back to a simple text box. (Javascript breaks?)

Thanks for your time.

dopry’s picture

You probably need to call the document ready js event again... or catch the reload submit/ajax process with your behavior assignment.

joostvdl’s picture

Same happens with FCKEditor enabled. After a Add another Item the content of the former filled fields is gone and the FCKeditor is also gone. Saving the content item and going back to edit it, recovers the FCKEditor.

yched’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

re #4: duplicate of #392294: CCK's "Add Another Item" button will make fckEditor disappear. - bug in FCK module.
More generally, all (ok, most ?) instance of "JS functionality X disappears when I hit 'add more' " are caused by the JS functionality not being attached to the page 'the right way', and should be reported to the module that adds the feature.

#2 point 1 is most likely unrelated, and should be reported in a separate issue. [edit: and I suspect there's something you're doing in your template that doesn't belong in there]

trailerparkopera’s picture

Seems like this problem is related to http://drupal.org/node/406050