telophase: (Mello - bite my ass)
telophase ([personal profile] telophase) wrote2010-10-27 03:43 pm

Okay, I'm stuck

So I'm attempting to use Javascript to make a dynamic feedback form that, when someone chooses a name from a drop-down menu, the questions below change (i.e., it's an evaluation form and each teacher has their own questions to get feedback from).

Ideally I'd like the questions, and associated HTML, to be in separate files for ease of editing. But I can't find any way at all to make them be included in the correct position. I'm currently looking at the innerHTML object, which seems great for posting one line, but when you want to post a huge bunch of lines or attempt to include a file, it's not as good.

Anyone out there with suggestions? This has been frustrating the hell out of me all day.

ETA; We are an ASP shop, BTW. And here's the function I've been working on:

The first line of the function changes the person to whom the form result is emailed. The rest is supposed to put the question in, in the 'librarianQuestions' div. All the include command does is include the actual text of the files, which screws the Javascript up because it tries to parse it as Javascript. Writing the include files all in Javascript would be ... less than ideal.


function emailLibrarian(email)
{
document.Form1.MailTo.value = email;

if ( email == "s.folse@tcu.edu" ){
document.getElementById("librarianQuestions").innerHTML = "";
}
if ( email == "telophase14@gmail.com" ){
document.getElementById("librarianQuestions").innerHTML = "";
}
if ( email == "" ) {
document.getElementById("librarianQuestions").innerHTML = "";
}
}

Post a comment in response:

This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting