0

I have 2 blocks on my shopping cart. The view block for the Main Product and another for the Specials ( which is an add-on), each block has their own delete button. I use a Views Field View on the Main Product block to call the Specials blocks. Each specials and main products are connected via node referencing. I can't use just 1 view block to show it like that because I need the added specials to be filtered/shown below the main product where it's connected.

enter image description here

When removing a specials, it deletes the line item properly but when I try to remove a main product it deletes the special that follows the main product and when there's no more special for that specific main product, it deletes the specials of other main product. It does not delete the line item where the remove is connected. I don't know why it works like that because each remove has their own line item.

1 Answer 1

1

Sounds to me like both of your forms on the page have the same form ID and use the same numeric key (likely 0) to identify the first item in the form. Thus when you submit it, Drupal doesn't know how to differentiate which form was submitted and makes a best guess, removing the 0th item in that form.

Alternately, if your configuration is generating a form within a form, that's invalid HTML and would explain a similar confusion on Drupal's part for the processing of the form. You would need to find an alternate method for getting the secondary form on the page, such as using the block system to embed the second form on the page.

2
  • Hi, it has different form ID but the form of the Specials ( add-on ) is inside the form of Main Product since the view was embedded within a view. how can I make this work?
    – Danz
    Mar 2, 2016 at 3:39
  • Ok, that is also illegitimate HTML and makes sense why Drupal wouldn't know what to do with the submission. You need it to be added to the page some other way, such as through the block system, to prevent it from becoming part of the other Views form. Mar 2, 2016 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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