Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) JavaScript newbie question

  • JavaScript newbie question

    Posted by Phil Incorvia on August 9, 2005 at 1:37 am

    Hello,

    I’m creating a simple shopping cart. The cart itself is on the same page as the items a visitor would order. I would like the cart to reflect changes made to pull-down menus which allow users to order from 0-10 of each item on a list of items without their needing to click an “update” or “add to cart” button. If you are on OS X, iPhoto’s interface for ordering prints from Kodak does exactly what I want.

    Example:

    Someone orders 5 of Widget #1 using a pulldown form object and the cart immediately displays 5

    They then order 3 of Widget #2 the same way and the cart updates to show a total of 8.

    Can this be done easily with JavaScript?

    Bonus question – can this value then be passed on to use in a PHP script?

    Thanks for any help!

    Phil

    Phil Incorvia replied 20 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Bret Lanius

    August 9, 2005 at 2:17 pm

    You can put code in the drop down’s onChange event to set the other field.

    When to send your variables you, as long as they are set in a form field for the current form they will be sent in the POST header. If not you have to make your own code and use the OnSubmit event to set them to hidden fields and send that way.

    Bret Lanius
    Atlanta Ga

  • Phil Incorvia

    August 10, 2005 at 1:55 pm

    Hi Brett,

    Thanks for your response. Is the code to change one field onChange a simple function? I can’t come up with what it would look like. Also, if I wanted the “total” field (the one updating with the pulldowns) to be un-editable, is there JavaScript to prevent it from being changed?

    I appreciate your time!

    Phil

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy