2

Having some trouble getting the empty_cart form element to work as a <button> element.

For example this works:

{exp:store:checkout next="store/checkout/1"}
  ...
  <input type="submit" name="empty_cart" value="Empty Cart" />
{/exp:store}

However using a button element instead of an input will not:

{exp:store:checkout next="store/checkout/1"}
  ...
  <button type="submit" name="empty_cart">Empty Cart</button>
{/exp:store:checkout}

The other inputs such as "update_cart" work fine as button elements. Is this a bug or am I just missing something?

The reason I want to use button elements is for styling purposes and I have to add an icon in the button using the CSS framework the project uses.

1 Answer 1

3

I think the problem is submitted data. A button (of submit type) will submit a form, but it won't pass any value as POST and Store requires that to confirm what you want to do.

Try:

<button type="submit" name="empty_cart" value="Empty Cart">Empty Cart</button>

Now it has a value, it'll be submitted with the form data and Store can read it.

1
  • Missed that one. Thanks. Works as expected now. Jul 23, 2013 at 10:48

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.