FORUMS: list search recent posts

JavaScript newbie question

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Phil-lipJavaScript newbie question
by on Aug 9, 2005 at 1:37:00 am


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.


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!


Return to posts index

Bret LaniusRe: JavaScript newbie question
by on Aug 9, 2005 at 2:17:11 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

Return to posts index

Phil-lipRe: JavaScript newbie question
by on Aug 10, 2005 at 1:55:37 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!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 All Rights Reserved