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!

Grand Total from multiple radio groups dot working
Last Post 09-01-2011 08:13 AM by Don Gee. 12 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
sentientUser is Offline
river guide
river guide
Posts:127
Avatar

--
08-26-2011 11:46 AM
    I'm trying to get the "grand total" for 6 radio groups. All are populated by the database and the value column is Decimal with 2 decimal places eg 12.35
    So I have set up 6 radio groups and 6 hidden fields to accept the values. It all works and the fields are getting the values but the total calc field (planTotal) is not showing to the total amount. What am I doing wrong? I need this for PayPal to work.

    For each radio: 
    $(totalBusPlan) = funcRadioCalc($(busOpt_FieldID))  /*This works for each*/

    The module javascript file:
    $(totalBusPlan) = funcRadioCalc($(busOpt_FieldID)) 
    $(totalVehPlan) = funcRadioCalc($(vehOpt_FieldID)) 
    $(totalPropPlan) = funcRadioCalc($(propOpt_FieldID)) 
    $(totalBusUp) = funcRadioCalc($(busUp_FieldID)) 
    $(totalVehUp) = funcRadioCalc($(vehUp_FieldID)) 
    $(totalPropUp) = funcRadioCalc($(propUp_FieldID)) 

    $(planTotal) = (totalBusPlan) + (totalPropPlan) + (totalVehPlan) + (totalPropUp) + (totalBusUp) + (totalVehUp)

    /*This Does not work*/

    I've tried with ALL the code in each questions client side event, no luck. I've tried with:
    $(planTotal) = parseFloat($(totalBusPlan)) + parseFloat($(totalPropPlan)) + parseFloat($(totalVehPlan)) + parseFloat($(totalPropUp)) + parseFloat($(totalBusUp)) + parseFloat($(totalVehUp))
    /*No luck*/
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-28-2011 03:47 AM
    Anyone?
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-28-2011 05:44 PM
    Figured out that the parseFloat function is correct however the calculation requires that ALL fields have a value before the grandtotal will work. So you need to set a default value for ALL the questions and that also means that you can only have 1 set of hidden radio buttons or the calculation will never work NaN as a result.

    It would be great to get some help now on how to deal with undefined initial values and NaN values so the form works.
    Don GeeUser is Offline
    river guide
    river guide
    Posts:273
    Avatar

    --
    08-29-2011 05:43 AM

    Hi Sentient,

    I think the following you still need the '$' to address your hidden fields in summing up the fields. Also check with the ';' for ending each sentence.

    $(totalBusPlan) = funcRadioCalc($(busOpt_FieldID))
    $(totalVehPlan) = funcRadioCalc($(vehOpt_FieldID))
    $(totalPropPlan) = funcRadioCalc($(propOpt_FieldID))
    $(totalBusUp) = funcRadioCalc($(busUp_FieldID))
    $(totalVehUp) = funcRadioCalc($(vehUp_FieldID))
    $(totalPropUp) = funcRadioCalc($(propUp_FieldID))

    $(planTotal) = $(totalBusPlan) + $(totalPropPlan) +$(totalVehPlan) + $(totalPropUp) + $(totalBusUp) + $(totalVehUp)

    Thanks
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-29-2011 06:14 AM
    If does work IF all values are selected. However when values are Hidden they no longer exist so there is the ussue of the calculation returning NaN from undefined values. In the form what that means is the value sent to the hidden field is retained rather than resetting.
    What I need to do is adapt the funcRadioCalc to return a specific value if the radio value does not exist. Im not a coder so I'm having no joy in making this work. Ive tried "if...else" and a "try...catch" but neither work. Have a look at the code below and tell me what Ive got wrong. THANKS!
    function funcRadioCalc(RadioName)
    {
    var chkList1= document.getElementById (RadioName);
    var arrayOfCheckBoxes= chkList1.getElementsByTagName("input");
    var bob;
    for(var i=0;i if (arrayOfCheckBoxes.checked) {
    bob= arrayOfCheckBoxes.value;
    }
    if (bob=""||bob=undefined){
    return "0.00";
    }else{
    return bob;
    }
    }
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-30-2011 06:52 AM
    Im really having issues with this. It would be great to get a datasprings person to reply. The issue is that the hidden field that pulls the value for the radio group that can be hidden, retains the value from when it was visible. So the grandtotal is incorrect as the value in the hidden field should return to 0 (or null).
    A question event, setting the default value does not work as the question no longer exists and setting the hidden field also doesnt work as it is dynamically trying to pull the hidden radio group.

    All this needs is a better funcRadioCalc function. Someone PLEASE help, I have to get this live.
    Don GeeUser is Offline
    river guide
    river guide
    Posts:273
    Avatar

    --
    08-30-2011 07:01 AM
    Hi Sentient,
    It may be best to put your sample on betasprings so more than one set of eyes can look at it here.

    I supplied below code in a previous answer. Did it work without error? If not tics may need to be put around the quantities and a ';' may need to end the sentence if it is followed by another sentence:

    $(planTotal) = $(totalBusPlan) + $(totalPropPlan) +$(totalVehPlan) + $(totalPropUp) + $(totalBusUp) + $(totalVehUp)

    For your above sentence there is a javascript " for in" and a "for each" statement so this line looks like it is not right as I don't see it following either format of "for in" or "for each"
    for(var i=0;i if (arrayOfCheckBoxes.checked) {
    bob= arrayOfCheckBoxes.value; }

    There is a site where you can check snippets of code out: www.jslint.com/ that might help you. Also you are supplying some very different pieces of sample code which looks like you have a pretty involved problem. Involved problems are more a category of Premium Support. Before going there you can go to betasprings and supply your whole problem there.

    Thanks
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-31-2011 06:00 AM
    The parseFloat() is fne and works for the grandTotal ONLY when ALL radio buttons have an active value. So if all don't have a default value or are NOT hidden there is a calculation error OR the calculation accepts OLD values from a hidden radio group.

    The funcRadioCalc is flawed. I've had no reply from DataSprings on this but I've gone to the forums and all agree that the function is flawed.

    It would be great to get some assistance by Chad or Candice but they dont seem to be available these last 5 days or so. So my site doesn't work *sigh*
    Don GeeUser is Offline
    river guide
    river guide
    Posts:273
    Avatar

    --
    08-31-2011 08:53 AM
    Hi Sentient,
    I have to ask you for a sample on BetaSprings for us to look at that would display the errors that you are getting. For now try this and see if you can get your funcRadioCalc to work in an isolated sample. I see samples where it is working. So see code setup below

    set up a custom html field and call it say: Amount = 0.00
    then set up a radio group with a couple values. Make sure there is a short name for the radio group. Lets say it is 'Test'. Make sure there are values for each item in the radio group like: 2,4,6 if you have three in the group.
    Make a text box without being hidden called: TestText.
    Now use this code like in the online sample 20 at DataSprings:

    document.getElementById('Testl').innerHTML = 'Your total comes to: ' + formatCurrency(parseInt(fucRadioCalc($(Test_FieldID)))) + '';

    $(TestText) = fucRadioCalc($(Test_FieldID))

    Play with this and see what happens. I may have this right enough that your text box or radio selection should push a value into both textbox and html fields. I didn't test though so I may have to come back to this but when done right I do see funcRadioCalc working.

    Thanks
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    08-31-2011 04:24 PM
    No its the function that is the issue. I know how all the other stuff works but the function does not check if the field is hidden (does not exist) and therefore returns 'undefined" that in turn makes the hidden field holding the value retain the old value, making the total calculation not work.
    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    09-01-2011 06:18 AM
    okay problem "solved". It was a case that the Dynamic Registration I was using 4.0.6 was out of date and was coded to perform the postback in the wrong order.

    So I used Dynamic Forms Ver:3.40.1.0 / 6.0.0 and it started working again. BUT I did have to add some other code to get it working correctly.

    You need a try get in the initial JS and client event to test if the radio group ID is available. Also rather than the existing fuctRadioCalc you can add am IF clause that pre populates the field with a default value.

    sentientUser is Offline
    river guide
    river guide
    Posts:127
    Avatar

    --
    09-01-2011 06:26 AM
    and the initial JS - put in client event too.
    try 
    { 
    //Run some code here 
    $(twoTotal) = funcRadioCalc($(twoRadio_FieldID)); 
    alert("radio found");//just for testing
    } 
    catch(err) 
    { 
    //Handle errors here 
    $(twoTotal) = "0.00"
    alert("radio NOT found");//just for testing
    } 
    $(oneTotal) = funcRadioCalc($(oneRadio_FieldID));
    $(grandTotal) = parseFloat($(oneTotal)) + parseFloat($(twoTotal)); 
    Don GeeUser is Offline
    river guide
    river guide
    Posts:273
    Avatar

    --
    09-01-2011 08:13 AM
    Hi Sentient,
    Good to see a resolution here.
    Thanks for the update
    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