ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

ZK Fiddle Integrated with ZK Froum - Online Live Coding Playground for the ZK Community!

southerncrossie
30 Aug 2011 03:13:32 GMT
30 Aug 2011 03:13:32 GMT

ZK Team has integrated ZK Fiddle with ZK Forum presenting the first online live coding playground in Java to the ZK Community, enabling developers with the ability to easily share code snippets for public viewing and to interact with each other in a more convenient manner.

For more information on how ZK Fiddle works, please check out the associated blog

terrytornadoTop Contributor
30 Aug 2011 14:52:12 GMT
30 Aug 2011 14:52:12 GMT

Many thanks for this incredible tool.

thanks
Stephan

PS: It can works too as a code repository. Don't forget to set up early a 'category' field for searching/ordering the code snippets.

TonyQ
30 Aug 2011 20:19:06 GMT
30 Aug 2011 20:19:06 GMT

We have tag already , is not good enough for organizing the samples?

terrytornadoTop Contributor
31 Aug 2011 02:58:06 GMT
31 Aug 2011 02:58:06 GMT

Ah, sorry, i have oversee this. Thanks Tony.

TonyQ
31 Aug 2011 11:32:58 GMT
31 Aug 2011 11:32:58 GMT

Haha,am just making sure we are not missing any useful features. :)

n0rthwood
30 Nov 2011 15:00:39 GMT
30 Nov 2011 15:00:39 GMT


Submited.zul
<zk xmlns:n="native">

<zscript>
Map m = Executions.getCurrent().getParameterMap();
Iterator ir = m.keySet().iterator();
StringBuffer sb = new StringBuffer();
while(ir.hasNext()){
String key = (String) ir.next();
sb.append(key+":"+m.get(key)[0] +"\n");
}
String ret = sb.toString();
</zscript>
<n:pre>
${ret};

${userName};
${password};
</n:pre>
</zk>

TestComposer.java
package j7v01um$v10;

import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zul.*;
import org.zkoss.zhtml.Form;

public class TestComposer extends GenericForwardComposer{

private Textbox userName;
private Textbox password;
private Form form;

public void onSubmit$form(Event e){
if(validate()){
Clients.evalJavaScript("jq('#"+form.getUuid()+"')[0].submit();");
}else{
try {
Messagebox.show("Wrong input ");
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}

public boolean validate(){
if(!userName.getValue().matches("\\w{4,15}")){
return false;
}
if(!password.getValue().matches("\\w{4,15}")){
return false;
}
return true;
}
}


index.zul
<zk xmlns:h="xhtml" xmlns:w="client">

<h:form id="form" apply="j7v01um$v10.TestComposer" action="Submited.zul" method="POST" >
<h:table>
<h:tr>
<h:tb> User Name </h:tb>
<h:tb>
<textbox id="userName" name="j_username"></textbox>
</h:tb>
</h:tr>
<h:tr>
<h:tb> Password </h:tb>
<h:tb>
<textbox id="password" type="password" name="j_password"></textbox>
</h:tb>
</h:tr>
<h:tr>
<h:tb>
<h:input type="submit" value="Login"></h:input>
</h:tb>
<h:tb>
<h:input type="button" value="Reset" h:onclick="cleanErr();" forward="onClick=onClean"></h:input>
</h:tb>
</h:tr>
</h:table>
</h:form>
<script>
zk.afterMount(function(){
jq("$form").submit(function(){
zAu.send(new zk.Event(zk.Widget.$(this), 'onSubmit'));
return false;
});
});
</script>

</zk>