www.webdeveloper.com
Results 1 to 2 of 2

Thread: JavaScript Issue. Newbie, not sure what to do

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    Question JavaScript Issue. Newbie, not sure what to do

    Hey folks,
    I am an admitted newbie at JavaScript, so please go easy on me! I've been trying so many different things, nothing seems to work.

    Here's the situation:

    Trying to create a Skill Test Form that has up to 12 users, and each user column has multiple sections. What I'm having an issue with is this: In section 1, there are four checkboxes for each user, and a total block, two of the checkboxes have a value of "3" and two of them have a value of "5". If all four boxes were checked, the user would score a total of 16 points. Problem is, the most points I can give them is 8 (More points are bad). So if both "5" checkboxes were checked, in the "total" block underneath them, I want to display an "8". If only one "5" block is checked, I want to display "5". I am using Adobe Acrobat to create the form.

    Here is an example of what I tried:

    var d = (sum(CheckBox1, CheckBox2, CheckBox3, CheckBox4));
    if (d>7) {8};
    else {(sum(CheckBox1, CheckBox2, CheckBox3, CheckBox4)};


    Again, I'm new at this, so after you've had a good chuckle over what I tried, can someone explain what I NEED to do to get it to work? I have to do this for 12 users, five sections each, up to 6 checkboxes for each section, each user. Once I have a functional template, it'll just be a matter of changing the fields around.. I hope..

    Thanks in advance for any suggestions!

    Dale


    Edit by admin: no contact info permitted on the forum, thank you

  2. #2
    Join Date
    Jan 2011
    Posts
    10
    As I see it, in your code example you doesn't set the d variable to 8, you have to set d = 8

    Code:
    ... code
    if(d>7) {
     d = 8;
    }
     code...
    Code:
    var d = (sum(CheckBox1, CheckBox2, CheckBox3, CheckBox4));
    if (d>7) {8}; // missing variable you have to set d = 8;
    else {(sum(CheckBox1, CheckBox2, CheckBox3, CheckBox4)};

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles