How to create a contact form with Jease?

Jease allows to include ZUL-Pages directly into your public website. ZUL (or ZUML) is the markup language defined by ZK which allows to build complex forms with a few lines of XML easily. The additional feature to include simple scripting elements directly into a ZUL page lets you build interactive forms based on the rich set of available ZK components to improve your website.

Here's an example how to create a simple contact form which sends out an email to the adress in charge. Just create a Script with extension .zul and you're done.

<vlayout width="100%"> 
  Name:
  <textbox id="name" hflex="1" constraint="no empty"/> 
  Email:
  <textbox id="email" hflex="1" constraint="/.+@.+\.[a-z]+/: No valid address" />
  Message:
  <textbox id="message" hflex="1" rows="10" constraint="no empty" /> 
  <button label="Send Message"> 
    <attribute name="onClick"><![CDATA[ 
      if(name.isValid() && email.isValid() && message.isValid()) { 
        jease.cms.service.Mails.send(
          email.value,
          "contact@jease.org",
          "Message from " + name.value + " <" + email.value + ">",
          message.value
        );
        name.rawValue = email.rawValue = message.rawValue = null;
        Messagebox.show("We have received your message.", "Thank you!",
                        Messagebox.OK, Messagebox.INFORMATION);
      } else {
        Messagebox.show("All fields are required!", "Error", 
                        Messagebox.OK, Messagebox.ERROR);
      }
    ]]></attribute>
 </button> 
</vlayout>

Please feel free to try out the form...

Processing...

Last modified on 2011-02-14 by Maik Jablonski

Java with Ease

1970-01-01

Java is a very productive development environment if you choose and combine the right tools and patterns.

Jease is the result of my personal quest bringing tools and patterns together which make the life of a web-developer as simple as it can be.