Site Home  »   Zoho Creator Help Center »  Form Actions »  Form Actions - Stateless Forms

Form Actions - Stateless Forms

Tags:  


Form Actions - Stateless Forms

By default, each form created in Zoho Creator will have a table generated at the back-end to store data submitted through the form. For example, when you create a Contacts form, a Contacts table is created and all data submitted through this form will be stored in this table. Zoho Creator supports creating stateless forms with scriptable buttons, that does not generate a table at the backend. (i.e) when you click on the form button, the entered data is not automatically added to the Table as an inserted record. Instead, you can add custom buttons and write deluge script in the "on click" event of the form. The scripts act on the "on click" button that can be programmed to do anything you can do in Deluge Script. This gives you the flexibility of storing the entered data into any field of any record of any Table in Zoho Creator. You can even use it to retrieve data from any field in any record of any Table in Zoho Creator.

Some common usage of the stateless forms are listed below:

  • Create Web Forms: Stateless Forms can act as web forms that are embedded in a website. This form data can be submitted to any service or used to update a record in another form/application, without persisting data in Zoho Creator. The Deluge Get URL and Post URL task can be used to get/post data to external websites or other Zoho Creator applications.
  • Create multiple forms updating data in a single table: Since a Stateless Form is by definition not joined with any particular Table, you can design different Stateless Forms each with a different subset of fields in a particular Table.  For example, you can create one Stateless Form for the role-technician and another Stateless form for the role-manager and share it to the respective roles but persist the data submitted from all the Stateless forms in the same main table. This enables different users within the same organization use the different Stateless Forms to perform their assigned tasks without having access to the other fields in the Table.
  • Create user settings dialog for the real time apps: Create a stateless form to enable users to customize all the properties of an application in one single form. For example, add a Settings link to your app that will fetch the record for the current logged in user and set the values in the on load of the stateless form. Users can modify their settings and submit the form. This form will then do an update record in the main form.
  • Fetch and Display information from other forms: Create a stateless form to fetch and display information from other Zoho Creator forms or from other services, based on the form input. For instance, assume you have a Status form in your application to display the status of a particular work order. When a user inputs his work order number and clicks on the form button, the status must be displayed. In this case, it is not necessary to store the form data. You can create a Status form and write on click form action to display the Status in a Note field.
  • Generate dynamic HTML views: Create stateless forms to generate dynamic HTML views by passing the form data as parameters to the view. For example, specify the search criteria to display records from a Contacts Management application, specify the Month and Year to display records pertaining to a specific period.
  • Execute send mail: Create a stateless form to execute any Deluge task like send mail, on click of the form button. In addition to on click form actions, you can also execute On user input field action scripts.

Creating a Stateless Form

To create a stateless form without data storage,

  1. Select Form -> New Form option. In the New Form dialog.
  2. Deselect the option Data to be stored in Zoho Creator
  3. Specify the Form name and click Done to create the stateless form.
  4. Drag-n-drop the required Fields to the form.
  5. Click on the Add a Button link, to add Submit, Reset and Custom buttons to the form, by specifying the button name and type.
        • Custom button: On mouse click, invokes the "On Click" action of the button.
        • Submit button: On mouse click or if Enter Key is pressed, invokes the "On Click" action of the button.
        • Reset button: On mouse click, form is taken to the initial state. "On Click" action cannot be configured for reset button.

  6. Click Done to add the button to the form.
  7. To perform any action on click of the form button, add the required deluge script  in the  Form Actions -> < Button Name> -> on click block of the Script tab. For example, if you add a custom button named "Add", write the Deluge script within Form Actions ->  Add -> on click block of the script tab. 
  8. Click  Save script to update the script.
  9. Click on Access this application and enter data to the stateless form.  On click of the form button, the script added to the "on click" block will be executed.

Example

Assume you have created a Contact form to enter the contact details of your friends like Name, Address, Contact Number and Email id. Now you want to update some existing records which has the address / contact number field as blank. To do this, you can create a stateless form to fetch and display data from the Contact form (main form), enter the required details and update this record in the Contact form.

  1. Create a stateless form with EmailId as lookup field from the Contact form and other required fields, as shown in the screen-shot given below:

  1. Add on user input script to the Email_Id field of the stateless form, to fetch the corresponding record from the Contact form and display it in the current form. Refer on user input script highlighted in the Form Definition given below.
  2. When a Email id is selected, the corresponding record is fetched from the Contact form and displayed in the statelessContact Form, as shown in the screen-shot below.

  1. Update the form with required values and click on the Update button. The modified values will be updated in the Contact form. This is achieved by writing action script to update the record in the Contact form. The script is added to the Form Actions -> Update -> on click block  Refer the code highlighted in the Form Definition given below.

Form Definition of the stateless Contact form with on click action script:

form  statelessContactForm
{
store data in zc = false

Lookup_1
(
displayname = "EmailId"
type = picklist
values = Contact.Email_Id
on user input
{
r = ContactForm [Email_Id == input.Lookup_1];
input.Address = r.Address;
input.Contact_Number = r.Contact_Number;
input.Name = r.Name;
}

)

Name
(
type = text
)

Address
(
type = textarea
)

Contact_Number
(
displayname = "Contact Number"
type = number
width = 20
)

actions
{
update
{
type = button
displayname = "Update"
on click
{
r = ContactForm [Email_Id == input.Lookup_1];
r.Name = input.Name;
r.Address = input.Address;
r.Contact_Number = input.Contact_Number;
}

}
reset
{
type = button
displayname = "reset"
}
}
}
 

ksaraf 763 - days ago 
I think this is very nice. My suggestion would be to make it more idiot proof with a graphic interface.
For example, just like you have the lookup field which can be dragged onto the form, you may have a stateless field which you can drag onto the form, and then get a box asking you to select which field from which form you want this to represent (update on submit).

It would make things a lot easier I think.
ksaraf 763 - days ago 
Also, if would be nice if you add an option to be able to duplicate a form and convert it to a stateless form. Then you can make a master form, and make several different sub forms which feed into it, depending on the rights of the user.
Right now, I have a big form and I would like about 6 different types of users to be able to edit different parts of it. With this above example that you have, it would take me days to make six different forms and program them all for on click do this and on select to that.
Guest 712 - days ago 
Yes,

A function of having a Master Form to allow easy creation of custom forms would come in very handy indeed! Please consider ZOHO.

Kind regards,

Silvester
davidglassglass 704 - days ago 
I signed an account at this wonderful ZOHO, I am looking to embed a script for Godaddy "Forgot your password?

To solve a problem with DotNetNuke stay at Godaddy, this hosting service requires use their own forms, and does not accept scripts from the application Dotnenuke.

I am excited about what I perform, I have many great websites on godaddy, moving from one host to another is very heavy time and money.

Thanks for any help!
afm.under 689 - days ago 
Can someone assist me with this? I have been trying to use the example on this page to get my stateless form to work. Every time I try to save my stateless form I get an error message about "actions" not being expected. But, I cannot see what I am doing wrong.

Since the system will not let me save due to the error I have kept the code in a text file so I don't lose it. It looks right to me, and this is frustrating. But, I am not a programmer.

Am willing to pay to get this to work since I don't think it will take long to fix. I am working on this for a non-profit.

Thanks,

Sean
latha 684 - days ago 
Sean: Can you send this issue to support and provide Edit access to support for your application. This will help us to analyze the issue further.

https://kbase.creator.zoho.com/share/edit-access-to-support
studentsuds 676 - days ago 
Is there a way to write a message for a submit button on click similar to any other form, like "Thank you, your data has been submitted" Thanks.
sparkyw 641 - days ago 
"Generate dynamic HTML views: Create stateless forms to generate dynamic HTML views by passing the form data as parameters to the view. For example, specify the search criteria to display records from a Contacts Management application, specify the Month and Year to display records pertaining to a specific period"

...can anyone explain how to do this in greater detail please.
tambayancenter 408 - days ago 
How can I edit a stateless form after I saved it? Or add/discard fields from the master form. Im tempted to delete the stateless form I made and construct a new one but Im afraid that it will also delete the fields along with its data in the master form.
microfab 376 - days ago 
I am also interested in how to edit a stateless form after saved, so the original form used to input the data is also used to edit the data
shashikant.purohit 352 - days ago 
Hi
I find that Permalink used for a stateless private form in zoho creator does not work
ldfldf 154 - days ago 
Any answers to this: "how to edit a stateless form after it's been saved"?




 RSS of this page