Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Client Side Calculation
Last Post 10-12-2012 06:19 AM by Ryan Bakerink. 7 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
BrettUser is Offline
wading in the water
wading in the water
Posts:22
Avatar

--
10-11-2012 05:42 AM
    I have a form that performs a calculation on several fields and then places the total in another field. This is what I have as the client side event and it works great: var Children = $(childrenParticipating); var Adults = $(adultsParticipating); var Hours = $(hoursServed); $(totalHoursGiven) = ((Children * 1) + (Adults * 1)) * (Hours * 1); There are some instances where this calculation needs to be overridden and the total entered manually. Can this be done?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-11-2012 08:37 AM
    Hello Brett,

    So here's your calculation:

    var Children = $(childrenParticipating); var Adults = $(adultsParticipating); var Hours = $(hoursServed); $(totalHoursGiven) = ((Children * 1) + (Adults * 1)) * (Hours * 1);

    If you need to perform a different calculation based on a certain condition, then program the condition using JavaScript, like the example below:

    var one = 'True';

    if(one == 'True')
    {
    var Children = $(childrenParticipating); var Adults = $(adultsParticipating); var Hours = $(hoursServed); $(totalHoursGiven) = ((Children * 1) + (Adults * 1)) * (Hours * 1);
    }
    else
    {
    var Children = // Different Calculation here
    }


    Just keep in mind, that you can separate calculations by using if, else if, and else statements in JavaScript. Whenever the time to override the calculation, make sure you have a condition in place.

    Please let me know if you have any questions.

    Thanks,

    Ryan
    BrettUser is Offline
    wading in the water
    wading in the water
    Posts:22
    Avatar

    --
    10-11-2012 11:10 AM
    Thanks for the reply Ryan.

    The calculation itself works fine:
    var Children = $(childrenParticipating);
    var Adults = $(adultsParticipating);
    var Hours = $(hoursServed);
    $(totalHoursGiven) = ((Children * 1) + (Adults * 1)) * (Hours * 1);

    I would like to be able to type a new number into the totalHoursGiven field after the calculation has been performed. I don't see how this can be done with an if then statement though.




    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-11-2012 12:02 PM
    Hello Brett,

    I don't feel as though your providing enough specific details.

    What does "Being able to type a new number into the totalHoursGiven field" mean to you?? I don't entirely understand what your question means.

    Is there a field on your form called totalHoursGiven? And after the Calculation on this field occurs, you'd like to be able to change the number of hours?

    Please provide as many useful details as possible.

    Thanks,

    Ryan
    BrettUser is Offline
    wading in the water
    wading in the water
    Posts:22
    Avatar

    --
    10-12-2012 05:52 AM
    Sorry about that.

    Yes exactly. There a field called totalHoursGiven where the calculation happens.

    After the Calculation on this field occurs, if I try to change the number it is automatically changed back by the calculation.

    Basically after the original calculation is made I would like to disable the calculation and override the number manually if necessary.


    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-12-2012 05:56 AM
    Hello Brett,

    I feel that you can use the following condition for your calculation:

    if($(totalHoursGiven) == '')
    {
    var Children = $(childrenParticipating);
    var Adults = $(adultsParticipating);
    var Hours = $(hoursServed);
    $(totalHoursGiven) = ((Children * 1) + (Adults * 1)) * (Hours * 1);
    }
    else
    {
    // Dont perform the calculation.
    var nothing;
    }

    Let me know if this helps or if you have any questions.

    Thanks,

    Ryan
    BrettUser is Offline
    wading in the water
    wading in the water
    Posts:22
    Avatar

    --
    10-12-2012 06:14 AM
    Ryan  -

    Thank you for your help with this! That is what I was trying to do, It works perfect.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-12-2012 06:19 AM
    Great to hear, glad that I could be of assistance.

    Hope you have a great weekend!

    -Ryan
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi