Form Script Help needed

Discussion in 'Software' started by Jodi, Jan 31, 2005.

  1. Jodi

    Jodi Private First Class

    Hey everyone, I have a form here that I am using as a model for script functionality for a different form, however the model I am using has much more than I need…

    I was wondering if anyone might be able to help me take out every thing I DON'T need in this script, while still utilizing the forms functionality.
    Here is the model; and the only fields I need are; the Qty, Description, Price and total, and I need them to "work". Thanks a bunch everyone! Greatly appreciated.

    ~Jo
     
  2. Jodi

    Jodi Private First Class

    OK NEW ONE HERE help anyone pleeeeease

    Hi Everyone, I have worked hard on this form and hit a brick wall
    Please click here to see
    I am sure it's something simple.
    Thanks!
    ~Jo
     
  3. mag00

    mag00 Sergeant

    So what's so bad about an extra $300 LOL.

    I don't know if this will help, but when I tick the check box it looks like it was a one or the other type box setup. I mean was it when one is ticked the other untics?

    I ask as the tick boxes look like little buttons and when I tick untick the second button changes under certain conditions. So whatever is causing that might be related to the 300 extra.

    I have absolutely no clue what that script should look like, I'm such a noob.
    Does it have to do with the semicolon? I give up, what's the answer?


    form.Amt7.value="";
    form. box1.value=""
    form.box2.value=""
    SSubTotal = 0;

    <dt class="style1"><label for="1">1</label>
    <input id="1" name="box1" type="checkbox" value="1">
    &nbsp; this value is 100&nbsp; </dt>
    <dt class="style1"><label for="2"></label></dt>
    <dd><span class="style1">2
    <input id="2" name="box2" type="checkbox" value="2"> this value is 200
    </span>
     
  4. Jodi

    Jodi Private First Class

    Thanks for the nice try, I am seeing that the check boxes are not on a one or the other script, I am seeing however that there is something in the script that automatically adds in the check box values to the total, weather or not I check them at al. You can see that if you just hit the calculate button without checking anything it adds them into the total. ARG. I get what the problem is, but I'll be darned if I can figure it out.

    ~Jo
    :rolleyes:
     
  5. mag00

    mag00 Sergeant

    Jo, in the code above are there not supposed to be semicolons at the end of the string to close it? They are missing in checkbox 1 and checkbox 2 line entries, but everywhere else you have the semi-colon. Also will the space ?

    form.Amt7.value="";
    form. box1.value="" (no semicolon)
    form.box2.value="" (no semicolon)
    SSubTotal = 0;

    I pulled this from the page source as written.

    Being that the checkboxes are the trouble, and that those particular line entries are missing the semicolon it drew my attention to that. I do not know if that is the trouble, but maybe add and see what happens. There is also a space extra.
     
  6. Jodi

    Jodi Private First Class

    Nice observation on that one, I tried adding the ; and it didnt do anything different. Darn. Ok time to take a JavaScript course LOL

    ~Jo
     
  7. mag00

    mag00 Sergeant

    I know nothing and I can prove it.

    Java course? Or would that be a cup of "jo". Uh oH, am I in trouble? :rolleyes:
    That's why I'm here, I don't know java but learning as I go. I'm finding this stuff more fascenating the more I learn.

    I was thinking that in your first lines that add properly, if you were to make the check boxes the same way but change the input to only register "1" as the value... hmmm, don't know how to explain that. Might be kindof Okee, but could possibly work. I'll go look at the code again to see what I can find.

    I'd like to see more people here in the programming section, but they're all drinking their java, hehehe.
     
  8. mag00

    mag00 Sergeant

    let me ask about the "*" vs the "=" in this below.

    SAmt7 = Math.round(eval(form.eight.value * 5000));

    box1= Math.round(eval(form.box1.value =10000));

    box2= Math.round(eval(form.box2.value =20000));


    #'s 1-7 have the * but in this same secion the box gets an "="

    Also there seems to be an extra space in the previous section where the semicolons were added.
    form.Amt7.value="";
    form. box1.value=""; extra space between form. and box1
    form.box2.value="";

    I don't know what a space would do. probably not the trouble, but could show differently on different browsers.

    Stotal = (SAmt0 + SAmt1 + SAmt2 + SAmt3 + SAmt4 + SAmt5+ SAmt6+ SAmt7 +box1 +box2);

    STotal =Stotal;

    if(SAmt0==0){ form.Amt0.value = '';
    } else { form.Amt0.value = AddDecimal(SAmt0);

    }if(SAmt1==0){ form.Amt1.value = '';
    } else { form.Amt1.value = AddDecimal(SAmt1);

    }if(SAmt2==0){ form.Amt2.value = '';
    } else { form.Amt2.value = AddDecimal(SAmt2);

    }if(SAmt3==0){ form.Amt3.value = '';
    } else { form.Amt3.value = AddDecimal(SAmt3);

    }if(SAmt4==0){ form.Amt4.value = '';
    } else { form.Amt4.value = AddDecimal(SAmt4);

    }if(SAmt5==0){ form.Amt5.value = '';
    } else { form.Amt5.value = AddDecimal(SAmt5);

    }if(SAmt6==0){ form.Amt6.value = '';
    } else { form.Amt6.value = AddDecimal(SAmt6);

    }if(SAmt7==0){ form.Amt7.value = '';
    } else { form.Amt7.value = AddDecimal(SAmt7);

    }if(box1==0)something something";-)
    do you need corresponding here to tell it not to add if not ticked?


    Can you give me a brief run through on how the script should process it?
    Not that I really need to know, but in doing so you may "discover" the bugs.
    If you want me to shut up just sayso.
     
  9. Jodi

    Jodi Private First Class

    Hey bud, glad to see you are trying so hard, I have had my nose in HUGE Java Script Book for the last few hours, what I need to learn is in Chapter 55, I am not on chapter 8. Anyway the script...ok lets see...
    The * indicates that the value entered into the field by the user will be MULTIPLIED by the number indicated after the *
    The = indicates that the value of that filed in = to the number after =
    Anyway for that one with the = sine, I need to incorporate a check box NOT a field where the user will enter a number because that field does not need to be multiplied, it just = that number.

    You may be on to something with this!

    }if(box1==0)something something" ;-)
    do you need corresponding here to tell it not to add if not ticked?

    But I guess the question of the day is still....ok so what's the answer? LOL
     
  10. Jodi

    Jodi Private First Class

    You see my whole intention is to ultimatley replace a few of those text boxes...specifically (if you view it again) the ones that I have highlighted in yellow to Check Boxes, so I am trying to incorporate check boxes into the script that will ADD to the TOTAL field.

    =)
    ~Jo
     
  11. Jodi

    Jodi Private First Class

    Geesh How about this, I can get JUST the check boxes to work, but nothing else does! Check it out
     
  12. mag00

    mag00 Sergeant

    They were kindof working, I checked and it was like two answeres were trying to display in the total box. Real weird like overlapping tables.

    Anyway I was on this site, http://www.w3schools.com/js/js_guidelines.asp searching for more info. I have a couple of those big thick books also. This site give an interactive demo of different code parameters, it's pretty cool.

    I didn't look for check boxes but if you go to the main page and back to html, they do cover check boxes there.
     
  13. mag00

    mag00 Sergeant

    So what in the code for the input field (check box) tells the java script the value. In a regular form you would assign yes or no or something like that. So wouldn't you have to alter the script then to identify a yes and then assign the value to that?

    Like if yes +100 if no 0 with the proper syntax of course. Then the above mentioned could calculate it, Man it's dark here, where's the light switch
    :)

    I just took a look at the source code again, you've been a busy bee.
    Whew!
     
  14. Jodi

    Jodi Private First Class

    OK after many hours of banging my head on the computer, I have decided to contact a good friend of mine who knows a Java Script Programmer, and will pose my question to him. I am sure that this form will be up and running in no time. I will post another message as soon as the results come in, for your curiosity's sake that is.

    ~Jo =)
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds