PDA

View Full Version : Web object interaction again



josecastello
01-03-2003, 08:49 AM
I have a web object containing a javascprit that creates a variable called "totalscore".
Well, this variable is shown on this web object by the following method (form):
<input type="text" size="4" name="totalscore">
Is there anyway to tell AMS to get that variable from the web object.
Thanks again.

Worm
01-03-2003, 10:12 AM
Could you use the action of your form to pass the score in the URL and parse the information from the URL on Navigate Complete.

josecastello
01-03-2003, 10:47 AM
Worm, can you be a little more especific (please, post the code if possible)?. Thanks a lot for your help.

Worm
01-03-2003, 11:32 AM
This probably is a crude way of doing, but it works.

Download (http://www.warmuskerken.com/ams/amshtm.zip)

josecastello
01-03-2003, 03:06 PM
Worm, thatīs brilliant. But I guess it wonīt work in my case, because the variable is stored in "Totalscore" but the value is not visible on the HTML code. Here you have the web object that I want to include in my AMS project. My plan is being able to print only the score (Totalscore) from AMS, so I need to get that variable (I donīt want to print the whole web object). Thanks for your help.
http://www.secpre.org/Todelete/javascript_quiz.htm (http:// http://www.secpre.org/Todelete/javascript_quiz.htm )

josecastello
01-03-2003, 03:08 PM
I guess you will need to copy and paste the previous link into your browser to get it work. Here it is again:
http://www.secpre.org/Todelete/javascript_quiz.htm

Corey
01-03-2003, 03:53 PM
Worm's method will work just fine, try it. You can easily pass that value (or any value) from your web object to your app via the URL.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

josecastello
01-03-2003, 05:27 PM
Sorry to bother you again. Can you post the same example but using my web object (http://www.secpre.org/Todelete/javascript_quiz.htm) instead of yours. I have tryied but I cannot get it to work.

Worm
01-03-2003, 06:06 PM
Maybe I'm a little thick skulled, but I don't see why this wouldn't work. Unless I totally misunderstand what you are trying to accomplish. I modified the javascript in you HTM file and made another sample app. Once you check the score, AMS will have a variable named %TotalScore% with same value as your HTM/Javascript variable.

Download Sample App (http://www.warmuskerken.com/ams/javaquiz.zip)

josecastello
01-04-2003, 06:16 AM
Thanks for your patience, Worm. You have understood perfectly what I am trying to accomplish. I downloaded your AMS file, but still doesnīt work. I got nothing in the Text Object (txtTotal) where the variable %TotalScore% is supposed to appear.

Worm
01-04-2003, 07:26 AM
Are you using the javascript_quiz.htm that I modified?

In the javascript that computes the total, the ELSE section should look like this:

document.quiz.totalscore.value = "You have " + tot + " correct answer(s) out of 10.";
window.location.href="javascript_quiz.htm" + "#totalscore=" + tot;

It works perfectly here. See the screen shot.
Screen Shot (http://www.warmuskerken.com/ams/screen1.jpg)