telophase: (Default)
telophase ([personal profile] telophase) wrote2005-02-17 01:21 pm

(no subject)

ARG.

If anyone out there has the least passing familiarty with Javascript, let me know! I have the following function, which prints information about quiz totals (number correct, number wrong, percentage correct) to the screen. I need to *somehow* dump it into the Value field of a form that passes the info onto a script that mails it. I can't figure out how.

function here since it was messing up friendspages

Nothing I do results in it ending up in a form field. Or doing anything other than, occasionally, rendering the entire quiz nonfunctional for some unknown reason. ARG.

This tutorial and quiz was originally created by UT in PHP and MySQL, but do we pick the language in which I can EASILY write this and which has an email-results-to-professor function embedded in it anyway? No! We pick the Javascript version done by UMich that has no email functionality whatsoever! And it's been up and running for months or years so there's no way I can tell them to use the other version! ARG!

[identity profile] mrissa.livejournal.com 2005-02-17 08:01 pm (UTC)(link)
This entry is screwing up my friendspage. There's a \n and the comments button and then a whole bunch of other people's entries, and it seems to be setting the width fairly narrow for the whole lot. Or something. I don't know, but it isn't good. Sorry it's so frustrating!

[identity profile] telophase.livejournal.com 2005-02-17 08:07 pm (UTC)(link)
Erg, sorry, will fix.

[identity profile] mrissa.livejournal.com 2005-02-17 08:24 pm (UTC)(link)
Thank you! Sorry I can't be of help.

[identity profile] jarodrussell.livejournal.com 2005-02-17 08:25 pm (UTC)(link)
Don't dump it to a field... Get it to redirect to a script with that stuff in the URL:

http://domain.com/mailer.php?score=100&percent=100&name=andrew+burton

To do that, check out this page (http://www.pageresource.com/jscript/jredir.htm).

[identity profile] telophase.livejournal.com 2005-02-17 08:38 pm (UTC)(link)
Problem, is I don't want them to be able to change their score.

[identity profile] jarodrussell.livejournal.com 2005-02-17 08:49 pm (UTC)(link)
But if this is all JavaScript, can't they do that anyway? But, eh... I see your point. How about this page (http://tech.irt.org/articles/js031/)?

[identity profile] telophase.livejournal.com 2005-02-17 08:57 pm (UTC)(link)
I'm sure they could, but I figure anyone who can get in there and change it that way is probably smart enough to pass the quiz anyway. :)

I ahve jsut figured out that it doesn't like teh hidden field, but I can tag a textarea as 'readonly' and they can't change it. So this may be my current solution, unless I find something elegant instead of klunky.

[identity profile] jarodrussell.livejournal.com 2005-02-17 09:07 pm (UTC)(link)
This is something (http://profnano.org/test/jstest.html) I whipped up that uses my original suggestion. Are you sure they'd be able to use that to cheat?

[identity profile] telophase.livejournal.com 2005-02-17 09:40 pm (UTC)(link)
I just did. :) After I submitted it the first time, I just changed the URL so that it read http://profnano.org/test/hello.php?name=im_cheating_this_way and hit enter, and it sent that along. So the *first* person couldn't cheat,but all he'd have to do was send the URL to his buddies and they could modify it to suit.

Anyway, I just figured out how to make a hidden field print (one of those duh! moments (http://www.sfolse.net/random/aarg2.txt)), and have successfully sent myself some quiz results. w00t!

[identity profile] jarodrussell.livejournal.com 2005-02-17 09:45 pm (UTC)(link)
What does the printQuizForm funtion do?

[identity profile] telophase.livejournal.com 2005-02-17 09:55 pm (UTC)(link)
Currently it produces the string "Right: 3 Wrong: 9 Percent right: 25" (with the actual numbers that the person got right or wrong; and which will be modified once I get word back from the people in charge as to what they want in the email). The actual file that contains that function is here (http://libnt4.lib.tcu.edu/www/eref/instruction/yourSearchpath/mod3/quiz/cookies.js).

I added printQuizForm at the very end of the file, modified from the original printQuizTotal, somewhere in the midst of the file, because the original contains HTML formatting and I wanted to send the messages plaintext. The quiz results page is here (http://libnt4.lib.tcu.edu/www/eref/instruction/yourSearchpath/mod3/quiz/results.html) and the quiz starts here (http://libnt4.lib.tcu.edu/www/eref/instruction/yourSearchpath/mod3/quiz/index.html), if you're bored and want to play. When you get to the results page, typing 'sfolse' into the box that pops up and asks you for your name produces the submit button; anything else doesn't.

I'm currently hijacking the script that sends comments to librarians (don't worry, it only mails to the email address you type in), since that's simplest. Once I find out what they want me to send in the emails, I may have to modify it to give me better formatting.
ext_1502: (Default)

[identity profile] sub-divided.livejournal.com 2005-02-17 09:40 pm (UTC)(link)
*ears prick up* UMich? That's my university!

(Er. From a user end most of the web-based stuff here is buggy as anything. Something goes down every month or so. And the email system is, well. "Cripled" might be giving it too much credit.)

[identity profile] telophase.livejournal.com 2005-02-17 09:45 pm (UTC)(link)
Heehee. Yup. Your library's Searchpath (http://www.lib.umich.edu/ugl/searchpath/) is the tutorial application we're using (http://libnt4.lib.tcu.edu/www/eref/instruction/yourSearchpath/choice.html). It's fine for what it is, but it doesn't have the simple ability to email results to people, which is what I was told to add. However, I think I had a breakthrough, yay.