Get a free trial // Grow your CSS skills // Land your dream job

Automatic Calculated Field

  • # February 25, 2012 at 10:18 am

    I have another Question!

    I have just realized that I will need to know the package names, the types of people (adult, senior, child, infant) as well as how many.

    Ontop of that , it needs to be sent to an email?

    I hope I’m still going about this project properly.

    # February 25, 2012 at 11:29 am

    Whats Included Lights N' Sights Night Venture Falls View Lights Night Hawk Evening Tourist Evening Overnighter
    Historic Niagara On The Lake a a a a a a
    Historic Queenston Village a a a a a a
    Niagara Parks Sight a a a a a a
    Niagara Helicopter Ride a a
    Clifton Hill Tourist Shops a a a a
    Sheraton Fallsview Hotel Buffet a a
    Niagara Falls Natural Wonder a a a a a a
    Journey Behind the Falls a a
    Dropoff & Pickup Niagara Hotel or B&B a
    Whats Included Lights N' Sights Night Venture Falls View Lights Night Hawk Evening Tourist Evening Overnighter
    Senior Citizens
    Children 4-12
    under 4
    Sub total:
    Final Total:


    Instead of the data values in the TR i would like them in the inputs because the prices vary per person/age group per package.
    so it would be like this:

    Price = $25
    Default-Val (num of people per age range per package) = 0
    newVal = _____

    subTotal = Price * newVal
    grandTotal = addedSubtotals

    the prices are already in the inputs.

    would that be okay?

    # February 26, 2012 at 12:54 pm

    is there maybe a wordpress plugin for this kind of thing?

    # February 26, 2012 at 4:36 pm


    Yeah I was trying to avoid having a value for each input… I figured there was a standard discount for each age group which is why I initially set up the table with a discount percentage to reduce the value.

    Sure it’s possible to calculate it off of each input, it’s a lot more troublesome because you have to do everything backwards – I mean, start from the input values and then check to see if it’s included in the column…

    I don’t want to sound mean, but I’m really just here to help you with questions, not do all of the work for you. And I don’t know much about WordPress plugins, but this might be too specific, but it can’t hurt to look.

    # February 27, 2012 at 5:22 pm

    I’ve been looking but have not found anything well enough.

    so I’ve decided to try a new approach which i believe would be a LOT less code and more efficient.

    I’m thinking with drop down menu (option boxes) you would select the Package then then separate option boxes where they can choose how many adults, seniors children and infants, with separate prices attached and in the end they will be able to calculate that.

    do i use an array?

    ill search anyways.

    and Mottie. I truly do appreciate everything. i really do. you’ve been fantastic, and i agree you shouldn’t do everything. so I’m going to do my best to do it myself.

    I’ve tried this for packages but that didn’t work..

    I am trying to do:

    if day = selected
    then display day packages
    night = selected
    then display night packages
    display day packages
    end if.

    I’ve read the article for dynamically adding content to a drop down.

    and going to continue to figure out how to do it :). wish me luck.

    # February 28, 2012 at 12:54 pm

    Cool! I’m still happy and willing to help you debug code, or even give hints.

    If you want to change the options in a select list, you’ll need to add and remove the options. IE doesn’t work well if you just hide them. So you can do something like this code:

    LOL nevermind.. darn OCD – check out this demo

    # February 29, 2012 at 5:05 pm

    okay so the only problem I’m having is displaying the price after submit.

    I’ve set up all other fields for when filling out the form and submitting, everything shows up. but the final price. i think its because its not in some sort of FORM input or object, rather its in a span.

    when you click submit i want it to go straight to an email. how do i get it to do that without opening some sort of mail client

    lets first tackle the displaying the final price if we can.

    # February 29, 2012 at 8:48 pm

    The last demo you shared had a final total, but no box and I wasn’t sure what price was supposed to go in there. Just add a span and then do whatever calculation you need to get the final total, then add it to the html.

    The email question is a bit out of my league… I’m guessing you’re using WordPress or something so you’ll have to ask a separate question for that

    # February 29, 2012 at 8:58 pm

    Do you want the email to send automatically in the background? or open an email and populate it with the data? I sure hope you aren’t collecting credit card info by email

    If its to send in the background I would post the data to a php script to generate the email and send it

    If you want to open up a new mail check out this script

    # February 29, 2012 at 10:57 pm

    its going to be an SSL secured page.


    could we get the final total into a input box, that can’t be changed? or is there another alternative of some sort?

    # March 1, 2012 at 5:20 am

    You could use

    Then populate it with JavaScript

    # March 1, 2012 at 10:38 am

    Or set an input to “readonly”

    # March 1, 2012 at 2:33 pm

    what would the new JS look like?

    # March 1, 2012 at 11:46 pm

    Now that “Grand-total” is an input, change the value, not the html:

    # March 2, 2012 at 12:22 pm

    I just talked to my boss and he said that instead of sending through email, they want it to upload to a database. I’m not sure how to do that, where can i learn how to do that?

Viewing 15 posts - 16 through 30 (of 32 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed