0

Is there any way to add a certain amount of field values to a standard node add/edit form (when unlimited option has been chosen) using a select input?

At the moment I have this working using javascript by triggering click on the 'add another' button, waiting a bit using setInterval (as the button disappears), then looping as many times as I need to, so the new fields gradually appear. This sort of works, but is very very dirty. Is there any proper way to add a certain number of field values based on a select option, and doesn't involved waiting?

0

I had the very similar problem, but with a group of fields that all needed to be added in sync. Using setTimeout to trigger is problematic because of the guess work involved.

One of the ways to do this is to use the ajaxSuccess event to chain a list of requests. After searching for a solution to my problem, I ended up creating a small plugin called group-add-more. This can work with both Drupal 6 as well as 7.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.