Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

promotions.js targeting incorrect hidden input #1274

Closed
agn507 opened this Issue Mar 15, 2012 · 3 comments

Comments

Projects
None yet
2 participants

agn507 commented Mar 15, 2012

In promotions.js line 45

var $hiddenField = $container.find("input[type='hidden']");

is targeting the wrong hidden input tag. It targets the promotion_action_id hidden tag removing the value all together. This results in an error

unknown attribute: line_items_string

when submitted.

This line should use the same target as create line item add button does

var $hiddenField = $container.find(".line_items_string");

Member

radar commented Mar 20, 2012

Could you please provide us with some steps to reproduce this issue? Thank you.

agn507 commented Mar 21, 2012

Sure.

Create a promotion (shouldn't matter what type but I used coupon_code_added)

Create an action of type "create line items"

Add a few products to it. You can either save at this point but I think the issue still applies if you follow the next step right away.

Try and remove one of the products from the action and hit Update for that action. You should get the "unknown attribute: line_items_string" error I mentioned above.

The problem appears to be that there are two hidden input tags for this action. The first holds the promotion action id

promotion_promotion_actions_attributes_2_id

The js targets the promotion action id when you remove a line item from it rather than the second hidden input with a class of "line_items_string". You can see that js for adding line items on this action properly targets the "line_items_string" input but the remove line item js does not.

@radar radar closed this in 9170dc3 Jun 4, 2012

Member

radar commented Jun 4, 2012

This unknown attribute error has been fixed, but while validating this I ran into another bug which I've also fixed.

Thanks!

cyu pushed a commit to Scoutmob/spree that referenced this issue Jun 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment