[Building Sakai] Debugging Javascript & Velocity
Daniel Merino
daniel.merino at unavarra.es
Thu Apr 25 01:24:03 PDT 2013
Hi, David & Adrian.
Thanks to Miguel Carro from Samoo I have managed to solve it.
Newer versions of Velocity use a new variable to prevent cross-site
scripting. It seems that 2.7 Velocity did not use it, but in 2.9 it does.
Adding the next line inside <form> tag in my vm file:
<input type="hidden" name="sakai_csrf_token" value="$sakai_csrf_token" />+
fixes my issue.
Still I don't imagine how could I have detected this by my own means,
but at least it is solved. :-)
Thanks a lot.
Best regards.
El 24/04/2013 15:17, David Adams escribió:
> If there are no problems on the Javascript side, then if possible,
> check the web server access logs to be sure that a request is being
> made when you click the button (though you should also be able to see
> this in Firebug/Chrome Dev Tools). If you know how to hook up Eclipse
> to do live debugging, that's probably the most useful thing you could
> do if a request is making it through. Or if you're not set up for
> that, just tossing in some logging statements in the code you expect
> to be called is usually what I end up doing (since I've never bothered
> to learn Eclipse).
>
> David Adams
> Director, Systems Integration and Support
> Virginia Tech Learning Technologies
>
>
> On Wed, Apr 24, 2013 at 6:39 AM, Daniel Merino
> <daniel.merino at unavarra.es <mailto:daniel.merino at unavarra.es>> wrote:
>
> Hi, David.
>
> I'm currently using Firebug 1.11.2 with Firefox 19.0.2, but
> console does not show errors when I click over the button, only
> lots of warnings that does not seem to be related with this issue.
>
> Maybe is a velocity issue, but I don't know how to check this.
>
> Thanks for your help.
> Best regards.
>
> El 24/04/2013 13:11, David Adams escribió:
>> Hi Daniel,
>> To troubleshoot Javascript, you'll need a client-side debugger.
>> I'm fond of the Developer Tools built into Google Chrome (under
>> the Tools submenu). Firefox has similar tools (Firebug was the
>> best one when I was using Firefox). If you pull those tools up
>> you should immediately see if there are issues on the page. Then
>> if you click the bad link, you should see what's going wrong. The
>> other, simpler option would be to just pull up the Javascript
>> Console on whatever browser you're using and it should display
>> some error or other that should lead you in the right direction.
>>
>> -dave
>>
>> David Adams
>> Director, Systems Integration and Support
>> Virginia Tech Learning Technologies
>>
>>
>> On Wed, Apr 24, 2013 at 6:02 AM, Daniel Merino
>> <daniel.merino at unavarra.es <mailto:daniel.merino at unavarra.es>> wrote:
>>
>> Hi everybody.
>>
>> I'm trying to fix a local patch that does not work, but I'm
>> not able to
>> find the error. Is Javascript code running inside a Velocity
>> template,
>> two technologies that I don't know very well. I hope some
>> experienced
>> developer can help me.
>>
>> In a vm file inside content tool, I have this code:
>>
>> <input type="button" class="active" name="savechanges"
>> id="savechanges"
>> onclick="javascript:showNotif('submitnotifxxx','savechanges','addContentForm');document.getElementById('addContentForm').action='#toolLink("ResourcesAction"
>> "doMultipleFoldersUpload")';submitform('addContentForm');"
>> value="$tlang.getString("label.continue")" accesskey="s" />
>>
>> that renders a Continue button. This button should call
>> doMultipleFoldersUpload method in ResourcesAction.java class,
>> but I have
>> checked that this method is not called and no error is shown
>> inside
>> Tomcat's logs.
>>
>> I don't know how to continue in order to detect this error. Could
>> somebody give me any hint or idea?
>>
>> If you need more information, just tell me.
>>
>> Thanks in advance.
>> Best regards,
>> --
>> Daniel Merino Echeverría
>> daniel.merino at unavarra.es <mailto:daniel.merino at unavarra.es>
>> Gestor de teleformación - Centro Superior de Innovación
>> Educativa.
>> Tfno: 948-168489 - Universidad Pública de Navarra.
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> <mailto:sakai-dev at collab.sakaiproject.org>
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org
>> <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a
>> subject of "unsubscribe"
>>
>>
>
> --
> Daniel Merino Echeverría
> daniel.merino at unavarra.es <mailto:daniel.merino at unavarra.es>
> Gestor de teleformación - Centro Superior de Innovación Educativa.
> Tfno: 948-168489 - Universidad Pública de Navarra.
> --
> Los amigos son para las ocasiones, salvo en determinados circulos
> político-económicos, en los que las ocasiones son para los amigos.
> (Perich)
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> <mailto:sakai-dev at collab.sakaiproject.org>
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org
> <mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a
> subject of "unsubscribe"
>
>
--
Daniel Merino Echeverría
daniel.merino at unavarra.es
Gestor de teleformación - Centro Superior de Innovación Educativa.
Tfno: 948-168489 - Universidad Pública de Navarra.
--
Muchas personas son lo bastante educadas como para no hablar con la boca
llena, pero no les preocupa hacerlo con la cabeza vacía. (Orson Welles)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20130425/e9088c3f/attachment.html
More information about the sakai-dev
mailing list