ZK Fiddle Integrated with ZK Froum - Online Live Coding Playground for the ZK Community!
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.
We have tag already , is not good enough for organizing the samples?
Ah, sorry, i have oversee this. Thanks Tony.
Haha,am just making sure we are not missing any useful features. :)
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>
ZK - Open Source Ajax Java Framework
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