Forums

This topic is locked

Drop down menu value HELP!!

Posted 26 Nov 2008 19:02:48
1
has voted
26 Nov 2008 19:02:48 Mike Mockford posted:
In my order form, I have a drop down menu with names of a range of kitchen designs.
I want to assign each design with a value that can alter the final price.

The rest of the for works well except for this one snag.
this is the URL:
www.romanticcottages.uk.com/kitchens/order.html

I have as yet no code in place to attempt to make these drop downs work...
(you will notice that my calculating code is a bit plonky but I'm happy with that because it is robust and modifiable.)

Any help would be greatly appreciated!!

Mike

Replies

Replied 27 Nov 2008 11:08:28
27 Nov 2008 11:08:28 Alan C replied:
Hi Mike

in the options, you can put whatever you want as the value while keeping the name as the text that your visitor will see, so you might have the values set as 1 for the base configuration, then 1.10 for a range that was 10% more, then you could use those as multipliers

www.w3schools.com/TAGS/tag_option.asp

You might even pick those up out of a database table so it's easier to update

I didn't pick through the code, but I certainly agree, clunky code is fine by me, it's more important that when I come back to it in a couple of years that I can alter it, or that someone else can, I'm not always going to be the person maintaining it
Replied 27 Nov 2008 11:19:16
27 Nov 2008 11:19:16 Mike Mockford replied:
Alan C,
Thanks for your help with this.

I'll give it a go.

There is one snag with this solution, in that when the form is submitted to me as an email, the value is sent and not the description from the pull down menu. So I have to go back and see what the number relates to which item on the drop down...

If that can be fixed then I will be in gravy.

www.romanticcottages.uk.com/kitchens/order.html

Mike
Replied 28 Nov 2008 13:01:46
28 Nov 2008 13:01:46 Alan C replied:
Hi Mike,
I'm thinking aloud on this, in case this answer sounds rambling <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

just had another look at the page, what about a hidden field on each line? Then you could pick up the range from the dropdown (I'm relatively new to javascript) maybe with an onChange event, and write it into the hidden field, then you have a record of the range that is selected, then you could have the multiplier in the value. On the other hand could you leave the value set to the range and have a javascript do a lookup based on the range to get the multiplier?

Most of my work is php and mysql, using a few javascript snippets for form validation, but I am currently working on a mapping project using google maps api so it's a case of getting my hands dirty and wading into js <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> now that I've found out some of the things it can do it has really expanded my repertoire, but as usual I have to be careful not to spread myself too thinly across too many things.

Reply to this topic