r0bertstevenfis
10-17-2003, 07:00 AM
Hi all,
I have been trying to get a script working which will allow textareas to be either DISABLED or not depending on whether they have clicked the radio button associated with the textarea.
This is for a survey type form, and I have many questions on the survey... most all radio button answers. Then I allow an additional comments field where they can give text input... but ONLY if they have first answered the question using the radio button.
The entire form is dynamically created looping through database fields and making the form on the fly.
My code so far looks like this:
<script language=javascript>
function EnableCommentsArea#GetEvaluationQuestions.ID#()
{
var RadioIndex;
for (RadioIndex = 0;
RadioIndex < document.EvaluationForm.IDPollAnswers#GetEvaluationQuestions.ID#.length;
RadioIndex++)
{
if (document.EvaluationForm.IDPollAnswers#GetEvaluationQuestions.ID#[RadioIndex].checked == true)
{
document.EvaluationForm.Comments#GetEvaluationQuestions.ID#.disabled==false;
}
else
{
document.EvaluationForm.Comments#GetEvaluationQuestions.ID#.disabled==true;
}
}
alert("you must make a selection before making comments");
}
</script>
then I have a radio button array, followed by the text area (looped and identified by the IDPollQuestions variable from the query):
<INPUT TYPE="radio"
NAME="IDPollAnswers#GetEvaluationQuestions.IDPollQuestions#"
VALUE="#GetEvaluationQuestions.AnswerID#">
<TEXTAREA COLS="80" ROWS="2" NAME="Comments#GetEvaluationQuestions.IDPollQuestions#" onKeyPress="EnableCommentsArea#GetEvaluationQuestions.ID#()"></TEXTAREA>
I am wasting far too much time on this, as I obviously am missing the boat on how to even think about this one.
Any assistance will be greatly appreciated!
Thanks
I have been trying to get a script working which will allow textareas to be either DISABLED or not depending on whether they have clicked the radio button associated with the textarea.
This is for a survey type form, and I have many questions on the survey... most all radio button answers. Then I allow an additional comments field where they can give text input... but ONLY if they have first answered the question using the radio button.
The entire form is dynamically created looping through database fields and making the form on the fly.
My code so far looks like this:
<script language=javascript>
function EnableCommentsArea#GetEvaluationQuestions.ID#()
{
var RadioIndex;
for (RadioIndex = 0;
RadioIndex < document.EvaluationForm.IDPollAnswers#GetEvaluationQuestions.ID#.length;
RadioIndex++)
{
if (document.EvaluationForm.IDPollAnswers#GetEvaluationQuestions.ID#[RadioIndex].checked == true)
{
document.EvaluationForm.Comments#GetEvaluationQuestions.ID#.disabled==false;
}
else
{
document.EvaluationForm.Comments#GetEvaluationQuestions.ID#.disabled==true;
}
}
alert("you must make a selection before making comments");
}
</script>
then I have a radio button array, followed by the text area (looped and identified by the IDPollQuestions variable from the query):
<INPUT TYPE="radio"
NAME="IDPollAnswers#GetEvaluationQuestions.IDPollQuestions#"
VALUE="#GetEvaluationQuestions.AnswerID#">
<TEXTAREA COLS="80" ROWS="2" NAME="Comments#GetEvaluationQuestions.IDPollQuestions#" onKeyPress="EnableCommentsArea#GetEvaluationQuestions.ID#()"></TEXTAREA>
I am wasting far too much time on this, as I obviously am missing the boat on how to even think about this one.
Any assistance will be greatly appreciated!
Thanks