×
Get new posts in your inbox

Zoho Creator : Creating Ajax forms

Zoho Creator | September 14, 2006 | 2 min read

We made another update in Zoho Creator and now you can

  • Improve the usability of a form by validating field data even before it is submitted.
  • Modify contents of the form dynamically when it is loaded.
  • Modify field values based on user action (on other fields).

See the sample registration form that you can even embed in your website. You can also see the working version and the deluge script.

1. It allows users to register till 1st January 2007. If you try to access the form after 1st Jan 2007, it will just display that the registration is closed. This validation is done when the form is loaded.

Deluge code snippet:

on load
{
    if (zoho.currenttime > ’01-Jan-2007 00:00:00′)
    {
         hide name;
         hide emailid;
         hide blog_url;
         hide about_yourself;
         hide emailiderror;
         set showmessage = “Registration is CLOSED!”;
    }
}

2. It is designed to accept only 100 registrations. It displays that the registration is closed if more number of people try to register. This validation is also done when the form is loaded.

Deluge code snippet:

on load
{
     if (count(Register) >= 100)
     {
         hide name;
         hide emailid;
         hide blog_url;
         hide about_yourself;
         hide emailiderror;
         set showmessage = “The registration is CLOSED!
We have exceeded the limit of 100 registrations”;
    }
}

3. A person can register with the same Email ID only once. This is done in the on change event of the Email ID field. An Ajax request is sent to the server to validate the Email ID.

Deluge code snippet:

on change
{
      if (count(Register[emailid == input.emailid]) > 0)
     {
           set emailiderror = “This email id already exists”;
           show emailiderror;
     }
}

We have added a few other features also in this update. Will be posting about them separately.
Do try this feature and send us your feedback / suggestions.

  1. renuka.chillal

    For point No. 3on change
    {
    if (count(Register[emailid == input.emailid]) > 0)
    {
    set emailiderror = “This email id already exists”;
    show emailiderror;
    }
    }is “emailiderror” is a form field or is this a std message field against each form field ?

  2. renuka.chillal

    For point No. 3on change
    {
    if (count(Register[emailid == input.emailid]) > 0)
    {
    set emailiderror = “This email id already exists”;
    show emailiderror;
    }
    }is “emailiderror” is a form field or is this a std message field against each form field ?