Page 1 of 1

do command + var containing Javascript

Posted: Mon Aug 23, 2010 7:39 pm
by cborn
Is it possible to compose a dynamic Javascript command and then load the variable into the 'do' command to execute?

I'm loading a revlet into a dynamic lesson page in a course management system. The revlet is collecting params from the page and I would like to use them to test for a create a new URL to go to when the revlet submission is complete. I've tried a number of different iterations of this and none of them seem to execute in the browser. Am I missing something or is there another way to do this?

Code: Select all

   put (tCurrentPageURL & "&pageid=" & tParams["pageid"]) into tNewPageURL
   put (quote & "window.location.href='" & tNewPageURL & "'" & quote) into tGoToNewPage
   do tGoToNewPage in browser
I've also tried:

Code: Select all

   put (tCurrentPageURL & "&pageid=" & tParams["pageid"]) into tNewPageURL
   put (quote & "window.location.href='" & tNewPageURL & "'" & quote) into tGoToNewPage
   put tGoToNewPage into field "Statements"
   do field "Statements" in browser
I have done a bunch of testing and I know that the tGoToNewPage is loading well-formed Javascript, but it is not executing. :(
I would appreciate any advice!!

carly

Re: do command + var containing Javascript

Posted: Mon Aug 23, 2010 10:34 pm
by Mark
Hi Carly,

Which version of RunRev are you using?
Try this:
put ("window.location.href='" & tNewPageURL & "'") into tGoToNewPage
Does your Javascript syntax work as part of an html file?

Best,

Mark

Re: do command + var containing Javascript

Posted: Mon Aug 23, 2010 10:38 pm
by cborn
Hi Mark,

I think I've tried that one already, too.

Yes, if we manually run that JS from an HTML file, it does work. I'm just not sure if I can use variables as the statementlist of the 'do' command.

Re: do command + var containing Javascript

Posted: Tue Aug 24, 2010 10:58 am
by Mark
Version?

Re: do command + var containing Javascript

Posted: Tue Aug 24, 2010 1:53 pm
by cborn
sorry, Rev Enterprise version 4.0.0, build 950

Re: do command + var containing Javascript

Posted: Tue Aug 24, 2010 3:31 pm
by cborn
In testing it out again this morning, it seems to behave as desired. I had thought I tried all iterations of the JS statement, but perhaps I missed the one that worked! :oops:

Thanks for the suggestion, Mark!

Re: do command + var containing Javascript

Posted: Tue Aug 24, 2010 5:38 pm
by Mark
I'm glad to know it works, cborn. Another reason why it didn't work before but did work now might be that you didn't have the latest version of the plug-in installer before. Just make sure to always have the latest version.

Best,

Mark