Jul 27, 2008

Help With Assigning Values To Form Options?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

free web hosting

Help With Assigning Values To Form Options?

PlugComputers
Hey,

Let me try to do my best to explain this...
I have a business website that specializes in building custom computers. Customers can use our online form to select components for their computer from various categories (Hard drive size, processor, memory, ect..)

Take a look at the page here: www.plugcomputers.com/amdschedule.php

As you can see there are many radio buttons with different computer part choices. I wanted to add some way to assign a dollar value to each different part, so the customer knows how much its costing them with each upgrade. If you scroll to the bottom of the page you will see some red text, I want that price to reflect the sum off all the choices they made above. Adding up all the different upgrade dollar amounts so that they have an idea how much their computer will be while selecting components.

The current red number at the bottom is the base price with all the default selected values.

For example, in the first category "Processor"
The base price includes the AMD x2 3800+, If i wanted the upgrade price for the next option (the AMD x2 4400+) to be +$50 how can I get that into the form so when the user clicks that radio the price at the bottom automatically adds $50?

Thank you and I appreciate any help...

 

 

 


Reply

jlhaslip
I don't have enough knowledge to apply the effect to your form, but I think the approach you need to take, if you want a dynamic, local update of the page total without a call to the server for updating prices is to use some javascript to do that.
Perhaps the "onchange" event is the secret?

Here is a snippet I use for temperature conversions between Celsius and Fahrenheit. I cut and pasted the code, so really can't explain the details, but it tells the form to update the 'other' temperature if you change one value. And it doesn't use checkboxes, so that is where I get lost.
CODE
<form>
F:&nbsp;&nbsp;
<input type="text" name="F" value="32" onChange="C.value = 100/(212-32) * (this.value - 32 )">

&nbsp;&nbsp;&nbsp;&nbsp;C:&nbsp;&nbsp;
<input type="text" name="C" value="0" onChange="F.value = (212-32)/100 * this.value + 32 "></font>
</form>

Just wondering if this Topic should be moved to the javascript Topics? Use the Reprt feature to request that it be moved, if you think your solution is better found over there. Thanks.

 

 

 


Reply

Imtay22
QUOTE(jlhaslip @ Feb 24 2007, 04:08 PM) *
Just wondering if this Topic should be moved to the javascript Topics? Use the Reprt feature to request that it be moved, if you think your solution is better found over there. Thanks.

It's a HTML attribute, actually. The form Element is using HTML to submit the form contents to the server. The Javascript Part of this is what get sent to the server. That's what I THINK. I'm Not sure, but ok.

~Imtay22

Reply

jlhaslip
Judging by this :
QUOTE
so the customer knows how much its costing them with each upgrade. If you scroll to the bottom of the page you will see some red text, I want that price to reflect the sum off all the choices they made above. Adding up all the different upgrade dollar amounts so that they have an idea how much their computer will be while selecting components.

I get the impression they want the upgraded amount without a server call. That would need js.

Reply

PlugComputers
Right jlhaslip, we don't need this dollar value to be saved anywhere or anything. I just want it to be visible at the time of selection so they know what price range their selections are putting them in.

Any idea how to do this with JS or whatever is needed?

Reply

jlhaslip
No, but I will move it to the javascript sub-forum.

Reply

PlugComputers
Thanks jlhaslip.

So anyone know any javascript and willing to help out a fellow forum member? haha. I know this probably isn't the easiest coding, but if you give me an example I'll probably be able to figure it out.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : assigning values options


    Looking for assigning, values, form, options,

Searching Video's for assigning, values, form, options,
advertisement



Help With Assigning Values To Form Options?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE