Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Numeric answer lower than previous answer

    I am trying to create a table where the numeric answer for column B must be lower than the numeric answer for column A. I am stuck and can't get any code to work. Any suggestions?

  • #2
    Regular Coder Rappa's Avatar
    Join Date
    Nov 2005
    Location
    LI
    Posts
    356
    Thanks
    21
    Thanked 9 Times in 9 Posts
    Thats way too brief, have you got any code to post? or a more specific question about what you want?

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    that is the problem. i am trying to create a code out of nothing. right now i have the table programmed, but need to somehow create the forcing of column B to be lower than column A. For example field Q13_A_1 has to be greater than or equal to field Q13_B_1. The logic for the table has to be created below this part of the table logic (this logic is just forcing all fields to be answered and to be answered with a whole number).

    ANY IDEAS????

    THANKS


    PdcNextPage();

    return true;
    }
    function PdcValidateQuestions(){
    if(document.PdcSurvey.Q13_A_1.value == '') {
    PdcJumpToQuestion('#Q13_A_1', 'Please tell about your CDs.');
    return false;
    }
    if(document.PdcSurvey.Q13_A_2.value == '') {
    PdcJumpToQuestion('#Q13_A_2', 'Please tell about your Digital albums.');
    return false;
    }
    if(document.PdcSurvey.Q13_A_3.value == '') {
    PdcJumpToQuestion('#Q13_A_3', 'Please tell about your Digital tracks.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_A_1.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1))) {
    PdcJumpToQuestion('#Q13_A_1', 'Your answer to CDs must be a whole number.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_A_2.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1))) {
    PdcJumpToQuestion('#Q13_A_2', 'Your answer to Digital albums must be a whole number.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_A_3.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1))) {
    PdcJumpToQuestion('#Q13_A_3', 'Your answer to Digital tracks must be a whole number.');
    return false;
    }
    if(document.PdcSurvey.Q13_B_1.value == '') {
    PdcJumpToQuestion('#Q13_B_1', 'Please tell about your CDs.');
    return false;
    }
    if(document.PdcSurvey.Q13_B_2.value == '') {
    PdcJumpToQuestion('#Q13_B_2', 'Please tell about your Digital albums.');
    return false;
    }
    if(document.PdcSurvey.Q13_B_3.value == '') {
    PdcJumpToQuestion('#Q13_B_3', 'Please tell about your Digital tracks.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_1.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1))) {
    PdcJumpToQuestion('#Q13_B_1', 'Your answer to CDs must be a whole number.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_2.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1))) {
    PdcJumpToQuestion('#Q13_B_2', 'Your answer to Digital albums must be a whole number.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_3.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1))) {
    PdcJumpToQuestion('#Q13_B_3', 'Your answer to Digital tracks must be a whole number.');
    return false;
    }
    return true;

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,252
    Thanks
    203
    Thanked 2,557 Times in 2,535 Posts
    Like this:

    var textValue = document.PdcSurvey.Q13_B_3.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue >= Q13_A_3.value)) {
    PdcJumpToQuestion('#Q13_B_3', 'Your answer to Digital tracks must be a whole number more than the answer to Q13_A_3.');
    return false;
    }

  • #5
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the answer Phillip M.!

    I am still having trouble with the code. It isnt performing the command. My new table logic reads below (I inserted the logic as a double check for the first column, only after it didnt work for the second column only). What am I missing? Thanks again!



    }
    function PdcValidateQuestions(){
    if(document.PdcSurvey.Q13_A_1.value == '') {
    PdcJumpToQuestion('#Q13_A_1', 'Please tell about your CDs.');
    return false;
    }
    if(document.PdcSurvey.Q13_A_2.value == '') {
    PdcJumpToQuestion('#Q13_A_2', 'Please tell about your digital albums.');
    return false;
    }
    if(document.PdcSurvey.Q13_A_3.value == '') {
    PdcJumpToQuestion('#Q13_A_3', 'Please tell about your digital tracks.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_A_1.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue >= Q13_B_1.value)) {
    PdcJumpToQuestion('#Q13_A_1', 'Your answer must be a whole number, more than the answer to CDs aquired in past three months.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_A_2.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue >= Q13_B_2.value)) {
    PdcJumpToQuestion('#Q13_A_2', 'Your answer must be a whole number, more than the answer to digital albums aquired in past three months.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_A_3.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue >= Q13_B_3.value)) {
    PdcJumpToQuestion('#Q13_A_3', 'Your answer must be a whole number, more than the answer to digital tracks aquired in past three months.');
    return false;
    }
    if(document.PdcSurvey.Q13_B_1.value == '') {
    PdcJumpToQuestion('#Q13_B_1', 'Please tell about your CDs.');
    return false;
    }
    if(document.PdcSurvey.Q13_B_2.value == '') {
    PdcJumpToQuestion('#Q13_B_2', 'Please tell about your Digital albums.');
    return false;
    }
    if(document.PdcSurvey.Q13_B_3.value == '') {
    PdcJumpToQuestion('#Q13_B_3', 'Please tell about your Digital tracks.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_1.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue <= Q13_A_1.value)) {
    PdcJumpToQuestion('#Q13_B_1', 'Your answer must be a whole number, less than the answer to CDs aquired in past year.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_2.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue <= Q13_A_2.value)) {
    PdcJumpToQuestion('#Q13_B_2', 'Your answer must be a whole number, less than the answer to digital albums aquired in past year.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_3.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue <= Q13_A_3.value)) {
    PdcJumpToQuestion('#Q13_B_3', 'Your answer must be a whole number, less than the answer to digital tracks aquired in past year.');
    return false;

  • #6
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just in case anyone reads this and has the same issue - I got the code to work by creating the following HTML
    }
    var textValue = document.PdcSurvey.Q13_B_1.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue > document.PdcSurvey.Q13_A_1.value)) {
    PdcJumpToQuestion('#Q13_B_1', 'Your answer must be a whole number. The number of CDs aquired in the past 3 months must be less than the number you own.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_2.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue > document.PdcSurvey.Q13_A_2.value)) {
    PdcJumpToQuestion('#Q13_B_2', 'Your answer must be a whole number. The number of digital albums aquired in the past 3 months must be less than the number you own.');
    return false;
    }
    var textValue = document.PdcSurvey.Q13_B_3.value;
    if((textValue != '') && ((isNaN(parseInt(textValue)) || textValue.search(/\./) > -1)) || (textValue > document.PdcSurvey.Q13_A_3.value)) {
    PdcJumpToQuestion('#Q13_B_3', 'Your answer must be a whole number. The number of digital tracks aquired in the past 3 months must be less than the number you own.');
    return false;
    }


  •  

    Posting Permissions

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