469,271 Members | 1,480 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

problem with user defined function on form 'onsubmit'

I have written a code (a translation of my first one) that is not working. I did a user defined function that is used on 'onsubmit'. It should total the value from the form selections and immediately return a numeric value to an alert box for the user to see. Then after the user clucks on the 'OK' button on alert box the form data is further processed by a 'PHP' script. I have posted the user defined function below and after the next 'code' tag is just a couple of the form objects (as there are a whole bunch). The full version of this code is already posted at www.supersmoothmoves.com if you care to see the whole code. When the user fills the form out, and submits, the expected result is never displayed, however, the 'PHP' script is executed.
What am I doing wrong? Can anyone help?
________________________________
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. <!--
  3. function formTotal () {
  4.        var ourForm = document.forms[0];
  5.        var aqsmIdx = ourForm.aqsm.selectedIndex;
  6.        var aqsm = ourForm.aqsm.options[aqsmIdx].value*1;
  7.        var aqlgIdx = ourForm.aqlg.selectedIndex;
  8.        var aqlg = ourForm.aqlg.options[aqlgIdx].value*1;
  9.        var aqxlIdx = ourForm.aqxl.selectedIndex;
  10.        var aqxl = ourForm.aqxl.options[aqxlIdx].value*1;
  11.        var armsmIdx = ourForm.armsm.selectedIndex;
  12.        var armsm = ourForm.armsm.options[armsmIdx].value*1;
  13.        var armlgIdx = ourForm.armlg.selectedIndex;
  14.        var armlg = ourForm.armlg.options[armlgIdx].value*1;
  15.        var bbqsmIdx = ourForm.bbqsm.selectedIndex;
  16.        var bbqsm = ourForm.bbqsm.options[bbqsmIdx].value*1;
  17.        var bbqlgIdx = ourForm.bbqlg.selectedIndex;
  18.        var bbqlg = ourForm.bbqlg.options[bbqlgIdx].value*1;
  19.        var bedKIdx = ourForm.bedK.selectedIndex;
  20.        var bedK = ourForm.bedK.options[bedKIdx].value*1;
  21.        var bedKdisIdx = ourForm.bedKdis.selectedIndex;
  22.        var bedKdis = ourForm.bedKdis.options[bedKdisIdx].value*1;
  23.        var bedKreIdx = ourForm.bedKre.selectedIndex;
  24.        var bedKre = ourForm.bedKre.options[bedKreIdx].value*1;
  25.        var bedQIdx = ourForm.bedQ.selectedIndex;
  26.        var bedQ = ourForm.bedQ.options[bedQIdx].value*1;
  27.        var bedQdisIdx = ourForm.bedQdis.selectedIndex;
  28.        var bedQdis = ourForm.bedQdis.options[bedQdisIdx].value*1;
  29.        var bedQreIdx = ourForm.bedQre.selectedIndex;
  30.        var bedQre = ourForm.bedQre.options[bedQreIdx].value*1;
  31.        var bedFIdx = ourForm.bedF.selectedIndex;
  32.        var bedF = ourForm.bedF.options[bedFIdx].value*1;
  33.        var bedFdisIdx = ourForm.bedFdis.selectedIndex;
  34.        var bedFdis = ourForm.bedFdis.options[bedFdisIdx].value*1;
  35.        var bedFreIdx = ourForm.bedFre.selectedIndex;
  36.        var bedFre = ourForm.bedFre.options[bedFreIdx].value*1;
  37.        var bedTIdx = ourForm.bedT.selectedIndex;
  38.        var bedT = ourForm.bedT.options[bedTIdx].value*1;
  39.        var bedTdisIdx = ourForm.bedTdis.selectedIndex;
  40.        var bedTdis = ourForm.bedTdis.options[bedTdisIdx].value*1;
  41.        var bedTreIdx = ourForm.bedTre.selectedIndex;
  42.        var bedTre = ourForm.bedTre.options[bedTreIdx].value*1;
  43.        var bedWIdx = ourForm.bedW.selectedIndex;
  44.        var bedW = ourForm.bedW.options[bedWIdx].value*1;
  45.        var bedWdisIdx = ourForm.bedWdis.selectedIndex;
  46.        var bedWdis = ourForm.bedWdis.options[bedWdisIdx].value*1;
  47.        var bedWreIdx = ourForm.bedWre.selectedIndex;
  48.        var bedWre = ourForm.bedWre.options[bedWreIdx].value*1;
  49.        var bedBIdx = ourForm.bedB.selectedIndex;
  50.        var bedB = ourForm.bedB.options[bedBIdx].value*1;
  51.        var bedBdisIdx = ourForm.bedBdis.selectedIndex;
  52.        var bedBdis = ourForm.bedBdis.options[bedBdisIdx].value*1;
  53.        var bedBreIdx = ourForm.bedBre.selectedIndex;
  54.        var bedBre = ourForm.bedBre.options[bedBreIdx].value*1;
  55.        var daybedIdx = ourForm.daybed.selectedIndex;
  56.        var daybed = ourForm.daybed.options[daybedIdx].value*1;
  57.        var daybeddisIdx = ourForm.daybeddis.selectedIndex;
  58.        var daybeddis = ourForm.daybeddis.options[daybeddisIdx].value*1;
  59.        var daybedreIdx = ourForm.daybedre.selectedIndex;
  60.        var daybedre = ourForm.daybedre.options[daybedreIdx].value*1;
  61.        var bikeIdx = ourForm.bike.selectedIndex;
  62.        var bike = ourForm.bike.options[bikeIdx].value*1;
  63.        var bikeEIdx = ourForm.bikeE.selectedIndex;
  64.        var bikeE = ourForm.bikeE.options[bikeEIdx].value*1;
  65.        var un50Idx = ourForm.un50.selectedIndex;
  66.        var un50 = ourForm.un50.options[un50Idx].value*1;
  67.        var ov50Idx = ourForm.ov50.selectedIndex;
  68.        var ov50 = ourForm.ov50.options[ov50Idx].value*1;
  69.        var boxWIdx = ourForm.boxW.selectedIndex;
  70.        var boxW = ourForm.boxW.options[boxWIdx].value*1;
  71.        var bshelf3Idx = ourForm.bshelf3.selectedIndex;
  72.        var bshelf3 = ourForm.bshelf3.options[bshelf3Idx].value*1;
  73.        var bshelf6Idx = ourForm.bshelf6.selectedIndex;
  74.        var bshelf6 = ourForm.bshelf6.options[bshelf6Idx].value*1;
  75.        var bshelf8Idx = ourForm.bshelf8.selectedIndex;
  76.        var bshelf8 = ourForm.bshelf8.options[bshelf8Idx].value*1;
  77.        var buffetIdx = ourForm.buffet.selectedIndex;
  78.        var buffet = ourForm.buffet.options[buffetIdx].value*1;
  79.        var armchIdx = ourForm.armch.selectedIndex;
  80.        var armch = ourForm.armch.options[armchIdx].value*1;
  81.        var chlgIdx = ourForm.chlg.selectedIndex;
  82.        var chlg = ourForm.chlg.options[chlgIdx].value*1;
  83.        var chsmIdx = ourForm.chsm.selectedIndex;
  84.        var chsm = ourForm.chsm.options[chsmIdx].value*1;
  85.        var chaiseIdx = ourForm.chaise.selectedIndex;
  86.        var chaise = ourForm.chaise.options[chaiseIdx].value*1;
  87.        var reclinIdx = ourForm.reclin.selectedIndex;
  88.        var reclin = ourForm.reclin.options[reclinIdx].value*1;
  89.        var ottoIdx = ourForm.otto.selectedIndex;
  90.        var otto = ourForm.otto.options[ottoIdx].value*1;
  91.        var cribIdx = ourForm.crib.selectedIndex;
  92.        var crib = ourForm.crib.options[cribIdx].value*1;
  93.        var cribdisIdx = ourForm.cribdis.selectedIndex;
  94.        var cribdis = ourForm.cribdis.options[cribdisIdx].value*1;
  95.        var cribreIdx = ourForm.cribre.selectedIndex;
  96.        var cribre = ourForm.cribre.options[cribreIdx].value*1;
  97.        var chestDIdx = ourForm.chestD.selectedIndex;
  98.        var chestD = ourForm.chestD.options[chestDIdx].value*1;
  99.        var CPLFIdx = ourForm.CPLF.selectedIndex;
  100.        var CPLF = ourForm.CPLF.options[CPLFIdx].value*1;
  101.        var copierIdx = ourForm.copier.selectedIndex;
  102.        var copier = ourForm.copier.options[copierIdx].value*1;
  103.        var copierflIdx = ourForm.copierfl.selectedIndex;
  104.        var copierfl = ourForm.copierfl.options[copierflIdx].value*1;
  105.        var copierstIdx = ourForm.copierst.selectedIndex;
  106.        var copierst = ourForm.copierst.options[copierstIdx].value*1;
  107.        var credenzaIdx = ourForm.credenza.selectedIndex;
  108.        var credenza = ourForm.credenza.options[credenzaIdx].value*1;
  109.        var credenzalgIdx = ourForm.credenzalg.selectedIndex;
  110.        var credenzalg = ourForm.credenzalg.options[credenzalgIdx].value*1;
  111.        var comdeskIdx = ourForm.comdesk.selectedIndex;
  112.        var comdesk = ourForm.comdesk.options[comdeskIdx].value*1;
  113.        var desksecIdx = ourForm.desksec.selectedIndex;
  114.        var desksec = ourForm.desksec.options[desksecIdx].value*1;
  115.        var desklgIdx = ourForm.desklg.selectedIndex;
  116.        var desklg = ourForm.desklg.options[desklgIdx].value*1;
  117.        var deskretIdx = ourForm.deskret.selectedIndex;
  118.        var deskret = ourForm.deskret.options[deskretIdx].value*1;
  119.        var deskretdisIdx = ourForm.deskretdis.selectedIndex;
  120.        var deskretdis = ourForm.deskretdis.options[deskretdisIdx].value*1;
  121.        var deskretreIdx = ourForm.deskretre.selectedIndex;
  122.        var deskretre = ourForm.deskretre.options[deskretreIdx].value*1;
  123.        var deskHIdx = ourForm.deskH.selectedIndex;
  124.        var deskH = ourForm.deskH.options[deskHIdx].value*1;
  125.        var dogIdx = ourForm.dog.selectedIndex;
  126.        var dog = ourForm.dog.options[dogIdx].value*1;
  127.        var doorremIdx = ourForm.doorrem.selectedIndex;
  128.        var doorrem = ourForm.doorrem.options[doorremIdx].value*1;
  129.        var drafttabIdx = ourForm.drafttab.selectedIndex;
  130.        var drafttab = ourForm.drafttab.options[drafttabIdx].value*1;
  131.        var dress3Idx = ourForm.dress3.selectedIndex;
  132.        var dress3 = ourForm.dress3.options[dress3Idx].value*1;
  133.        var dress6Idx = ourForm.dress6.selectedIndex;
  134.        var dress6 = ourForm.dress6.options[dress6Idx].value*1;
Expand|Select|Wrap|Line Numbers
  1.        var entIdx = ourForm.ent.selectedIndex;
  2.        var ent = ourForm.ent.options[entIdx].value*1;
  3.        var ent2Idx = ourForm.ent2.selectedIndex;
  4.        var ent2 = ourForm.ent2.options[ent2Idx].value*1;
  5.        var ent3Idx = ourForm.ent3.selectedIndex;
  6.        var ent3 = ourForm.ent3.options[ent3Idx].value*1;
  7.        var entdisIdx = ourForm.entdis.selectedIndex;
  8.        var entdis = ourForm.entdis.options[entdisIdx].value*1;
  9.        var entreIdx = ourForm.entre.selectedIndex;
  10.        var entre = ourForm.entre.options[entreIdx].value*1;
  11.        var fileIdx = ourForm.file.selectedIndex;
  12.        var file = ourForm.file.options[fileIdx].value*1;
  13.        var file2Idx = ourForm.file2.selectedIndex;
  14.        var file2 = ourForm.file2.options[file2Idx].value*1;
  15.        var file3Idx = ourForm.file3.selectedIndex;
  16.        var file3 = ourForm.file3.options[file3Idx].value*1;
  17.        var file4Idx = ourForm.file4.selectedIndex;
  18.        var file4 = ourForm.file4.options[file4Idx].value*1;
  19.        var latfile2Idx = ourForm.latfile2.selectedIndex;
  20.        var latfile2 = ourForm.latfile2.options[latfile2Idx].value*1;
  21.        var latfile3Idx = ourForm.latfile3.selectedIndex;
  22.        var latfile3 = ourForm.latfile3.options[latfile3Idx].value*1;
  23.        var latfile4Idx = ourForm.latfile4.selectedIndex;
  24.        var latfile4 = ourForm.latfile4.options[latfile4Idx].value*1;
  25.        var freezIdx = ourForm.freez.selectedIndex;
  26.        var freez = ourForm.freez.options[freezIdx].value*1;
  27.        var footIdx = ourForm.foot.selectedIndex;
  28.        var foot = ourForm.foot.options[footIdx].value*1;
  29.        var gtoolIdx = ourForm.gtool.selectedIndex;
  30.        var gtool = ourForm.gtool.options[gtoolIdx].value*1;
  31.        var glassTcIdx = ourForm.glassTc.selectedIndex;
  32.        var glassTc = ourForm.glassTc.options[glassTcIdx].value*1;
  33.        var glassTdIdx = ourForm.glassTd.selectedIndex;
  34.        var glassTd = ourForm.glassTd.options[glassTdIdx].value*1;
  35.        var glassShIdx = ourForm.glassSh.selectedIndex;
  36.        var glassSh = ourForm.glassSh.options[glassShIdx].value*1;
  37.        var cabIdx = ourForm.cab.selectedIndex;
  38.        var cab = ourForm.cab.options[cabIdx].value*1;
  39.        var ibIdx = ourForm.ib.selectedIndex;
  40.        var ib = ourForm.ib.options[ibIdx].value*1;
  41.        var lampIdx = ourForm.lamp.selectedIndex;
  42.        var lamp = ourForm.lamp.options[lampIdx].value*1;
  43.        var lampFIdx = ourForm.lampF.selectedIndex;
  44.        var lampF = ourForm.lampF.options[lampFIdx].value*1;
  45.        var mowerIdx = ourForm.mower.selectedIndex;
  46.        var mower = ourForm.mower.options[mowerIdx].value*1;
  47.        var microIdx = ourForm.micro.selectedIndex;
  48.        var micro = ourForm.micro.options[microIdx].value*1;
  49.        var microstIdx = ourForm.microst.selectedIndex;
  50.        var microst = ourForm.microst.options[microstIdx].value*1;
  51.        var mirIdx = ourForm.mir.selectedIndex;
  52.        var mir = ourForm.mir.options[mirIdx].value*1;
  53.        var mirdisIdx = ourForm.mirdis.selectedIndex;
  54.        var mirdis = ourForm.mirdis.options[mirdisIdx].value*1;
  55.        var mirreIdx = ourForm.mirre.selectedIndex;
  56.        var mirre = ourForm.mirre.options[mirreIdx].value*1;
  57.        var nstandIdx = ourForm.nstand.selectedIndex;
  58.        var nstand = ourForm.nstand.options[nstandIdx].value*1;
  59.        var organEIdx = ourForm.organE.selectedIndex;
  60.        var organE = ourForm.organE.options[organEIdx].value*1;
  61.        var pianoSpIdx = ourForm.pianoSp.selectedIndex;
  62.        var pianoSp = ourForm.pianoSp.options[pianoSpIdx].value*1;
  63.        var pianoUpIdx = ourForm.pianoUp.selectedIndex;
  64.        var pianoUp = ourForm.pianoUp.options[pianoUpIdx].value*1;
  65.        var pianoGrIdx = ourForm.pianoGr.selectedIndex;
  66.        var pianoGr = ourForm.pianoGr.options[pianoGrIdx].value*1;
  67.        var picsmIdx = ourForm.picsm.selectedIndex;
  68.        var picsm = ourForm.picsm.options[picsmIdx].value*1;
  69.        var plantsmIdx = ourForm.plantsm.selectedIndex;
  70.        var plantsm = ourForm.plantsm.options[plantsmIdx].value*1;
  71.        var plantlgIdx = ourForm.plantlg.selectedIndex;
  72.        var plantlg = ourForm.plantlg.options[plantlgIdx].value*1;
  73.        var piclgIdx = ourForm.piclg.selectedIndex;
  74.        var piclg = ourForm.piclg.options[piclgIdx].value*1;
  75.        var frigIdx = ourForm.frig.selectedIndex;
  76.        var frig = ourForm.frig.options[frigIdx].value*1;
  77.        var frigdisIdx = ourForm.frigdis.selectedIndex;
  78.        var frigdis = ourForm.frigdis.options[frigdisIdx].value*1;
  79.        var frigreIdx = ourForm.frigre.selectedIndex;
  80.        var frigre = ourForm.frigre.options[frigreIdx].value*1;
  81.        var rugsmIdx = ourForm.rugsm.selectedIndex;
  82.        var rugsm = ourForm.rugsm.options[rugsmIdx].value*1;
  83.        var rugmdIdx = ourForm.rugmd.selectedIndex;
  84.        var rugmd = ourForm.rugmd.options[rugmdIdx].value*1;
  85.        var ruglgIdx = ourForm.ruglg.selectedIndex;
  86.        var ruglg = ourForm.ruglg.options[ruglgIdx].value*1;
  87.        var safesmIdx = ourForm.safesm.selectedIndex;
  88.        var safesm = ourForm.safesm.options[safesmIdx].value*1;
  89.        var safelgIdx = ourForm.safelg.selectedIndex;
  90.        var safelg = ourForm.safelg.options[safelgIdx].value*1;
  91.        var safegunIdx = ourForm.safegun.selectedIndex;
  92.        var safegun = ourForm.safegun.options[safegunIdx].value*1;
  93.        var sculpIdx = ourForm.sculp.selectedIndex;
  94.        var sculp = ourForm.sculp.options[sculpIdx].value*1;
  95.        var stcabIdx = ourForm.stcab.selectedIndex;
  96.        var stcab = ourForm.stcab.options[stcabIdx].value*1;
  97.        var stcompIdx = ourForm.stcomp.selectedIndex;
  98.        var stcomp = ourForm.stcomp.options[stcompIdx].value*1;
  99.        var sewIdx = ourForm.sew.selectedIndex;
  100.        var sew = ourForm.sew.options[sewIdx].value*1;
  101.        var sofa2Idx = ourForm.sofa2.selectedIndex;
  102.        var sofa2 = ourForm.sofa2.options[sofa2Idx].value*1;
  103.        var sofa3Idx = ourForm.sofa3.selectedIndex;
  104.        var sofa3 = ourForm.sofa3.options[sofa3Idx].value*1;
  105.        var sofasecIdx = ourForm.sofasec.selectedIndex;
  106.        var sofasec = ourForm.sofasec.options[sofasecIdx].value*1;
  107.        var swingsmIdx = ourForm.swingsm.selectedIndex;
  108.        var swingsm = ourForm.swingsm.options[swingsmIdx].value*1;
  109.        var swinglgIdx = ourForm.swinglg.selectedIndex;
  110.        var swinglg = ourForm.swinglg.options[swinglgIdx].value*1;
  111.        var swingdisIdx = ourForm.swingdis.selectedIndex;
  112.        var swingdis = ourForm.swingdis.options[swingdisIdx].value*1;
  113.        var swingreIdx = ourForm.swingre.selectedIndex;
  114.        var swingre = ourForm.swingre.options[swingreIdx].value*1;
Expand|Select|Wrap|Line Numbers
  1.        var coftabIdx = ourForm.coftab.selectedIndex;
  2.        var coftab = ourForm.coftab.options[coftabIdx].value*1;
  3.        var endtabIdx = ourForm.endtab.selectedIndex;
  4.        var endtab = ourForm.endtab.options[endtabIdx].value*1;
  5.        var dintabIdx = ourForm.dintab.selectedIndex;
  6.        var dintab = ourForm.dintab.options[dintabIdx].value*1;
  7.        var dintablgIdx = ourForm.dintablg.selectedIndex;
  8.        var dintablg = ourForm.dintablg.options[dintablgIdx].value*1;
  9.        var contabIdx = ourForm.contab.selectedIndex;
  10.        var contab = ourForm.contab.options[contabIdx].value*1;
  11.        var contablgIdx = ourForm.contablg.selectedIndex;
  12.        var contablg = ourForm.contablg.options[contablgIdx].value*1;
  13.        var contabdisIdx = ourForm.contabdis.selectedIndex;
  14.        var contabdis = ourForm.contabdis.options[contabdisIdx].value*1;
  15.        var contabreIdx = ourForm.contabre.selectedIndex;
  16.        var contabre = ourForm.contabre.options[contabreIdx].value*1;
  17.        var tboxsmIdx = ourForm.tboxsm.selectedIndex;
  18.        var tboxsm = ourForm.tboxsm.options[tboxsmIdx].value*1;
  19.        var tboxmdIdx = ourForm.tboxmd.selectedIndex;
  20.        var tboxmd = ourForm.tboxmd.options[tboxmdIdx].value*1;
  21.        var tboxlgIdx = ourForm.tboxlg.selectedIndex;
  22.        var tboxlg = ourForm.tboxlg.options[tboxlgIdx].value*1;
  23.        var trampIdx = ourForm.tramp.selectedIndex;
  24.        var tramp = ourForm.tramp.options[trampIdx].value*1;
  25.        var tramplgIdx = ourForm.tramplg.selectedIndex;
  26.        var tramplg = ourForm.tramplg.options[tramplgIdx].value*1;
  27.        var trampdisIdx = ourForm.trampdis.selectedIndex;
  28.        var trampdis = ourForm.trampdis.options[trampdisIdx].value*1;
  29.        var trampreIdx = ourForm.trampre.selectedIndex;
  30.        var trampre = ourForm.trampre.options[trampreIdx].value*1;
  31.        var tmailIdx = ourForm.tmail.selectedIndex;
  32.        var tmail = ourForm.tmail.options[tmailIdx].value*1;
  33.        var tvPIdx = ourForm.tvP.selectedIndex;
  34.        var tvP = ourForm.tvP.options[tvPIdx].value*1;
  35.        var tvCIdx = ourForm.tvC.selectedIndex;
  36.        var tvC = ourForm.tvC.options[tvCIdx].value*1;
  37.        var tvBSIdx = ourForm.tvBS.selectedIndex;
  38.        var tvBS = ourForm.tvBS.options[tvBSIdx].value*1;
  39.        var tvstIdx = ourForm.tvst.selectedIndex;
  40.        var tvst = ourForm.tvst.options[tvstIdx].value*1;
  41.        var typeIdx = ourForm.type.selectedIndex;
  42.        var type = ourForm.type.options[typeIdx].value*1;
  43.        var typestIdx = ourForm.typest.selectedIndex;
  44.        var typest = ourForm.typest.options[typestIdx].value*1;
  45.        var vcrdvdIdx = ourForm.vcrdvd.selectedIndex;
  46.        var vcrdvd = ourForm.vcrdvd.options[vcrdvdIdx].value*1;
  47.        var vacIdx = ourForm.vac.selectedIndex;
  48.        var vac = ourForm.vac.options[vacIdx].value*1;
  49.        var vanIdx = ourForm.van.selectedIndex;
  50.        var van = ourForm.van.options[vanIdx].value*1;
  51.        var washIdx = ourForm.wash.selectedIndex;
  52.        var wash = ourForm.wash.options[washIdx].value*1;
  53.        var washdisIdx = ourForm.washdis.selectedIndex;
  54.        var washdis = ourForm.washdis.options[washdisIdx].value*1;
  55.        var washreIdx = ourForm.washre.selectedIndex;
  56.        var washre = ourForm.washre.options[washreIdx].value*1;
  57.        var dryIdx = ourForm.dry.selectedIndex;
  58.        var dry = ourForm.dry.options[dryIdx].value*1;
  59.        var drydisIdx = ourForm.drydis.selectedIndex;
  60.        var drydis = ourForm.drydis.options[drydisIdx].value*1;
  61.        var dryreIdx = ourForm.dryre.selectedIndex;
  62.        var dryre = ourForm.dryre.options[dryreIdx].value*1;
  63.        var wbenchIdx = ourForm.wbench.selectedIndex;
  64.        var wbench = ourForm.wbench.options[wbenchIdx].value*1;
  65.        var wbenchdisIdx = ourForm.wbenchdis.selectedIndex;
  66.        var wbenchdis = ourForm.wbenchdis.options[wbenchdisIdx].value*1;
  67.        var wbenchreIdx = ourForm.wbenchre.selectedIndex;
  68.        var wbenchre = ourForm.wbenchre.options[wbenchreIdx].value*1;
  69.        var gymIdx = ourForm.gym.selectedIndex;
  70.        var gym = ourForm.gym.options[gymIdx].value*1;
  71.        var gymdisIdx = ourForm.gymdis.selectedIndex;
  72.        var gymdis = ourForm.gymdis.options[gymdisIdx].value*1;
  73.        var gymreIdx = ourForm.gymre.selectedIndex;
  74.        var gymre = ourForm.gymre.options[gymreIdx].value*1;
  75.        var weightIdx = ourForm.weight.selectedIndex;
  76.        var weight = ourForm.weight.options[weightIdx].value*1;
  77.        var milesIdx = ourForm.miles.selectedIndex;
  78.        var miles = ourForm.miles.options[milesIdx].value*1;
  79.        var longWalkIdx = ourForm.longWalk.selectedIndex;
  80.        var longWalk = ourForm.longWalk.options[longWalkIdx].value*1;
  81.        var stairflightsIdx = ourForm.stairflights.selectedIndex;
  82.        var stairflights = ourForm.stairflights.options[stairflightsIdx].value*1;
  83.         var addstopIdx = ourForm.addstop.selectedIndex;
  84.        var addstop = ourForm.addstop.options[addstopIdx].value*1;
  85.  
Expand|Select|Wrap|Line Numbers
  1.        var preTotal = aqsm + aqlg + aqxl + armsm + armlg + bbqsm + bbqlg + bedK + bedKdis + bedKre + bedQ + bedQdis + bedQre + bedF + bedFdis + bedFre + bedT + bedTdis + bedTre + bedW + bedWdis + bedWre + bedB + bedBdis + bedBre + daybed + daybeddis + daybedre + bike + bikeE + un50 + ov50 + boxW + bshelf3 + bshelf6 + bshelf8 + buffet + armch + chlg + chsm + chaise + reclin + otto + crib + cribdis + cribre + chestD + CPLF + copier + copierfl + copierst + credenza + credenzalg + comdesk + desksec + desklg + deskex + deskret + deskretdis + deskretre + deskH + dog+ doorrem + drafttab + dress3 + dress6 + ent + ent2 + ent3 + entdis + entre + file + file2 + file3 + file4 + latfile2 + latfile3 + latfile4 + freez + foot + gtool + glassTc + glassTd + glassSh + cab + ib + lamp + lampF + mower + micro + microst + mir + mirdis + mirre + nstand + organE + pianoSp + pianoUp + pianoGr + picsm + plantsm + plantlg + piclg + frig + frigdis + frigre + rugsm + rugmd + ruglg + safesm + safelg + safegun + sculp + stcab + stcomp + sew + sofa2 + sofa3 + sofasec + swingsm + swinglg + swingdis + swingre + coftab + endtab + dintab + dintablg + contab + contablg + contabdis + contabre + tboxsm + tboxmd + tboxlg + tramp + tramplg + trampdis + trampre + tmail + tvP + tvC + tvBS + tvst + type + typest + vcrdvd + vac + van + wash + washdis + washre + dry + drydis + dryre + wbench + wbenchdis + wbenchre + gym + gymdis + gymre + weight + miles
  2.        var preTotal2 = preTotal * longWalk;
  3.        var preTotal3 = preTotal * stairflights;
  4.        var Total = preTotal + preTotal2 + preTotal3
  5.        alert(Total);
  6.        return;
  7.        }
  8. //-->
  9. </script>
______________-
having trouble posting q, tried with no code tags, then tried just the user defined function...
Sep 10 '07 #1
6 2383
sorry about no tags...
here is the partial form code...
__________________________________________
Expand|Select|Wrap|Line Numbers
  1.         <tr>
  2.           <td>Additional Stops</td>
  3.           <td><div align="justify">
  4.             <select name="addstop" id="addstop">
  5.               <option value="0">0</option>
  6.               <option value=".1">1</option>
  7.               <option value=".15">2</option>
  8.               <option value=".2">3</option>
  9.               <option value=".25">4</option>
  10.             </select>
  11.           </div></td>
  12.         </tr>
  13.         <tr>
  14.           <td><input type="text" name="Name" id="Name" />
  15.           Name</td>
  16.           <td>&nbsp;</td>
  17.         </tr>
  18.         <tr>
  19.           <td><p>
  20.             <input type="text" name="E-Mail" id="E-Mail" />
  21.           E-Mail</p>          </td>
  22.           <td>&nbsp;</td>
  23.         </tr>
  24.         <tr>
  25.           <td><input type="text" name="textfield" id="textfield" />
  26.           Move Date</td>
  27.           <td>&nbsp;</td>
  28.         </tr>
  29.         <tr>
  30.           <td><input name="onlineestimatorsubmitbutton2" type="submit" class="CollapsiblePanel" id="onlineestimatorsubmitbutoon3" onclick="MM_callJS('processOnlineEstimatorRequest()')" value="Get Quote" />
  31.               <input name="onlineestimatorresetbutton2" type="reset" class="CollapsiblePanel" id="onlineestimatorresetbutton3" value="Reset Form" /></td>
  32.           <td>&nbsp;</td>
  33.         </tr>
  34.         <tr>
  35.           <td>&nbsp;</td>
  36.           <td>&nbsp;</td>
  37.         </tr>
  38.       </table>
  39.   </form>
  40.     <br class="clearfloat" />
  41. <!-- end #container --></div>
  42. <script type="text/javascript">
  43. <!--
  44. var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("Aquarium1panel", {contentIsOpen:false});
  45. //-->
  46. </script>
  47. </body>
  48.  
__________________________________
Please help!!!!!
Sep 10 '07 #2
iam_clint
1,208 Expert 1GB
wow.... thats alot of typing (theres a faster and easier/better way)

What exactly are you trying todo? total up the value of the select boxes?

how about this.

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function getTotal() {
  3.     var frm = document.getElementsByTagName("select");
  4.     var total = 0;
  5.     for (i=0; i<frm.length; i++) {
  6.         total+=parseInt(frm[i].options[frm[i].selectedIndex].value);
  7.     }
  8.     alert(total);
  9.     return true;
  10. }
  11. </script>
  12. <form id="OnlineEsitmator" name="OnlineEsitmator" method="GET" action="formsubmissionscript.php" onSubmit="getTotal();">
  13.  

cut your javascript down a few hundred lines.
Sep 10 '07 #3
yes. the values that the options contain are just dollar values, with the exception of the last 7 form objects. The last four are just input fields. But the three before the last fours options are multipliers. I need to total up the option values for all the menu items besides the last seven, then the last three dropdowns need to be multiplied individually to the 'preTotal' value and then all added together. I also need that total to appear in an alert box before submission. Can you help? I already tried your suggestion and cut the code down a couple of hundred lines... Is it the PHP script that is not allowing the function to operate before submission?
Sep 10 '07 #4
iam_clint
1,208 Expert 1GB
yes i can help, did you implement my <form> ?
this will take care of the 3
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function getTotal() {
  3.     var frm = document.getElementsByTagName("select");
  4.     var total = 0;
  5.     for (i=0; i<frm.length-3; i++) {
  6.         total+=parseInt(frm[i].options[frm[i].selectedIndex].value);
  7.     }
  8.     alert(total);
  9.     return true;
  10. }
  11. </script>
  12. <form id="OnlineEsitmator" name="OnlineEsitmator" method="GET" action="formsubmissionscript.php" onSubmit="getTotal();">
  13.  
Sep 10 '07 #5
yes i can help, did you implement my <form> ?
I did and man that is a much easier way to do what I did, however I cannot seem to get the alert box result when submitting. What else is wrong? You can see the whole updated code at www.supersmoothmoves.com .
Sep 10 '07 #6
iam_clint
1,208 Expert 1GB
Not sure why you changed my [i]'s to [x]'s, i changed the variable frm to selbx to help your confusion i think.


this works. needs no changes.

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function getTotal() {
  3.     var selbx = document.getElementsByTagName("select");
  4.     var ourForm = document.forms[0];
  5.     var preTotal = 0;
  6.     var longWalk = parseFloat(ourForm.longWalk.options[ourForm.longWalk.selectedIndex].value);
  7.     var stairflights = parseFloat(ourForm.stairflights.options[ourForm.stairflights.selectedIndex].value);
  8.     var addstop = parseFloat(ourForm.addstop.options[ourForm.addstop.selectedIndex].value);
  9.     for (i=0; i<selbx.length-4; i++) {
  10.         preTotal+=parseInt(selbx[i].options[selbx[i].selectedIndex].value);
  11.     }
  12.     var preTotal2 = Math.floor(preTotal*longWalk);
  13.     var preTotal3 = Math.floor(preTotal*stairflights);
  14.     var Total = Math.floor(preTotal + preTotal2 + preTotal3);
  15.     alert(Total);
  16.     return true;
  17. }
  18. </script>
  19.  
Sep 10 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Dennis M. Marks | last post: by
3 posts views Thread by z24 | last post: by
8 posts views Thread by Arthur Rusdell-Wilson | last post: by
12 posts views Thread by Pudlik, Szymon | last post: by
1 post views Thread by rmgalante | last post: by
3 posts views Thread by davidjcampos | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.