-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I need to use Clients.evalJavaScript inside zscript.
The probleme is I can't work with date.
if I write String start="2011-04-15" i don't get the result
Clients.evalJavaScript("alert("+start+");
thanks for any help
Please post a simple self-contained example which shows the problem.
Cheers, Maik
Ok, i would really appreciate your help.
Below is a piece of my code.I need to send the selected date and list to a javascript function.
<zk> <window id="win"> <groupbox id="gb" > <hbox> Date: <datebox id="startDate" format="dd-MM-yyyy" /> </hbox> <listbox id="list"> <listhead sizable="true"> <listheader label="list" /> </listhead> </listbox> <button id="bt" label="send" onClick="test()" /> </groupbox> <zscript deferrred="true"> import java.text.SimpleDateFormat; import java.text.DateFormat; void test() { DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy"); String datestart=dateFormat.format(startDate.getValue()); String list=list.getSelectedItem().getLabel(); Clients.evalJavaScript("testjsfunction("+datestart+")"); } } </zscript> //javascript function wich call a servlet function testjsfunction(parameter){ $.getJSON("servlettest?parameter="+parameter+"",{} ,function(data){ ........ }
no test you case, but it looks like you have wrong js. you miss quotes
Clients.evalJavaScript("testjsfunction('"+datestart+"')");
testjsfunction(' " + datestart + " ') " (add more space to show you)
Asked: 2011-04-15 16:04:14 +0800
Seen: 597 times
Last updated: Apr 18 '11