...

View Full Version : Numeric answer lower than previous answer



yuro
02-26-2007, 05:49 PM
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?

Rappa
02-26-2007, 06:46 PM
Thats way too brief, have you got any code to post? or a more specific question about what you want?

yuro
02-27-2007, 04:06 PM
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;

Philip M
02-27-2007, 07:09 PM
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;
}

yuro
02-28-2007, 02:09 PM
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;

yuro
03-02-2007, 06:14 PM
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;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum