[Building Sakai] How to use velocity variable with javascript in .vm file?

Trí Ngô Thanh tridaihiep1711 at gmail.com
Sat Dec 11 10:30:15 PST 2010


Hi guys,
I'm trying to modify user-tool ins Sakai and now i'm having some problems:

- I used loop in .vm file (#foreach), in that loop i used checkbox and all i
wanted that was the checkbox returned value if it was checked or not (stored
in a list),but i found if difficult to get value because it can't be called
by "document.getElementById().checked" like HTML. So i tried using
Javascript and found new problem : can't connect variable of velocity in js.
For example :
#set ($check = false) //(both outside or inside js will be fine)
$check = document.getElementById("test").check; //(in js,rightside is true)
But $check didn't change its value .

- Another problem is i can't use loop in js.
Example:
for (i=0;i<$input.size();i++)
        {
                 document.write($input.get(i));  // (if i use number, that
ok, but it don't understand i, why?)
        }



Thanks for reading,
Regards
-- 
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20101212/fd5af5d0/attachment.html 


More information about the sakai-dev mailing list