What is Zoho Creator | The Basics| Design & Share Custom Forms |Using prevalidated Form Fields | Statless Forms |
With the basics in place, I guess, now its time for us to look into some of the advanced features that you can implement within Zoho Creator application.i.e you can come up with more customizations based on your requirements. This will be a combination of form’s design & a little more Deluge script that usual.
The Assignment :-
Application Name :- Event Management
Forms used :
- Master Form _Event Management (Stores data in Master View)
- Event Details Form (Stateless Form)
- Contact Details Form (Stateless Form)
Click to View Demo
This Event Management Application has the details of a particular event & the contact info of the person who is responsible for this event. I hope you would remember me saying in my earlier posts that, by default, Zoho Creator stores the data entered into the forms in tables, called as Views.
However, Zoho Creator has another set of forms called the Stateless Forms. i.e. the data entered within these forms, will not be saved. ( — what the heck! , what is the purpose of having a form that does not save data — , Hey! Friend, hold your horses. You will soon find out.)
As the name suggests, anything entered into the master form will be stored in its View. Stateless forms merely pulls the data from the master form & displays it for you to edit & confirm the edits. After doing the edits, when you go back to the main form’s View, you will notice that the edits have been implemented in the master-view as well. Sample Application here
The fields we will be using will be as follows
Master Form’s details
This is a regular form, Created the normal way. Forgot,see here
Event_Contact_ID*
Contact_Name – This is a required field
Contact_email
Contact_Phone
Event_Name – This is a required field
Event_Venue
Event_Date
Stateless Form (Stateless forms are those, whose data are not stored in Zoho Creator.)
It is a single choice that eventually decides if a form is stateless or not.
Form Fields :-
Event Details Form (Stateless Form)
Event_Contact_ID* — > This will be a look-up field.
Event_Name
Event_Venue
Event_Date
Contact Form (Stateless Form)
Event_Contact_ID –> This will be a look up field
Contact_Name
Contact_email
Contact_Phone
Using the look up field to “show data from other forms”
Remember to include the “SUBMIT” button in your stateless forms
The Tricky part – Deluge Scripting
Master form :-
The EventContact_ID* is the most important field, because, this links all the 3 forms in this application. Hence this has to be unique. We will be generating this UniqueID using deluge script.That means, the user is not allowed to enter anything in this field. Which in turn means, go back to your Master form – Edit the field for Event Contact ID , and say – Hide this field to others. ( of course, “you” will still see it).
Deluge Script to generate the Event Contact ID.
Don’t forget to save the script.
Now run your application & enter some data into the master form.
Go to Master view and cross verify if the data is getting saved along with the auto-generated “Event Contact ID”
Verify your “Lookup field” in “Event details form” & “Contact details form”.
If you had set up the look up field for “Event Contact ID” correctly (in the stateless forms), you should be able to see all od the Event Contact ID’s in this drop down list. Nothing will happen yet, just run both forms & see if the values are shown in live mode.
Deluge script to “Call the data” from the master view.
Up until now, you had been using the “Set Variable” in the script. Now, in order to “call the data”, we will be using “Fetch Records” feature. So what happens with this option. . .
You “Fetch Record – data “ from a certain View & Store it in a variable. This variable is now becomes a “Collection-variable” , (User Defined collection, to be more precise) ie .. Collection of data from field 1, field 2, field 3.. So on and so forth.
Question:- when to fetch the record – data ?
Answer :- After the user selects the value from the “look up field”
Now that you have “Fetched the record data”, its time to show them in the form. Use Set variable to achieve this.
input.EventVenue = RecData.EventVenue;
input.EventDate = RecData.EventDate;
Repeat the same exersise at Contact Details form
RecData = MasterDetails_EventManagement [EventContact_ID == input.EventContact_ID];
input.ContactName = RecData.ContactName;
input.ContactPhone = RecData.ContactPhone;
input.Contactemail = RecData.Contactemail;
Deluge script to rewrite the entry in the master view ( table)
Now, you should be able to see relevant records in the stateless form based on the value from the Event Contact ID list. Next step would be to edit other details & Submit the (Stateless) form. This should inturn update the details in the master view.
Answer :- After the submit button is clicked.
Deluge Script code will be :-
RecData = MasterDetails_EventManagement [EventContact_ID == input.EventContact_ID]; //Use Fetch Records , to call the record data
RecData.ContactName = input.ContactName; //For these, use Update Records
RecData.ContactPhone = input.ContactPhone;
RecData.Contactemail = input.Contactemail;
Reload;
Repeat the same excersie in Contact Details Form ( Stateless Form)
RecData = MasterDetails_EventManagement [EventContact_ID == input.EventContact_ID]; //Use Fetch Records , to call the record data
RecData.ContactName = input.ContactName; // use Update Records
RecData.ContactPhone = input.ContactPhone;
RecData.Contactemail = input.Contactemail;
Reload;
Run the application & let me know if you are able to update the master field from the stateless forms. Not happening.. Feel free to drop a word to me. We will figure it out together. Chao =;
Your appreciation is my motivation
What is Zoho Creator | The Basics| Design & Share Custom Forms |Using prevalidated Form Fields | Statless Forms |
Asathare Deepa. Write a book:)
Yeah, this blog is awesome dude. I was trying to give myself a crash course with the Zoho documentation, but it mostly assumes a familiarity with scripting I didn't have yet. This is invaluable. -T.
Thanks Anon, Glad you found this useful
Deepa, i need your help in building a stateless form..I am totally ignorant about scripting but what i’m wonder , can your above example be a standard for building any stateless form? Can i use your example and just add my own fields and get the same results as yours?
Hi Vishan,
Yes, This is the “general set up” of things. Free free to use the examples in your application.
All the best
Hey thanks for your prompt reply…I have a job for you…Check you Inbox 🙂
Regards
How do you fetch records form a FORM “A” into a STATELESS FORM, and then update the input into a FORM “B” (they all have common fields of course)? I have tried this but keep getting an error message.
Hi MP.
This demo for stateless form does exactly what you ask for.
# Master form – regular form – (like your FORM A)
# Event Details form – Stateles form ( Like your STATELESS FORM 1). This “Fetches the details from FORM A based on the Lookup field’s value in this demo
# The retreived values, are displayed in this STATELESS FORM 1
# The details are edited upon submission, The Master-FORM is updated.
Refer this part in the post:[–Question:- when to update the record in master view
Answer :- After the submit button is clicked.–]
Can you tell me more about your error message. May be its a minor glitch.
Got that to work, was wondering if there was a way to email submit stateless forms and in that way edit through email already entered records?
I’m not sure if something has changed since this blog was posted, but the tutorial seems to no longer work as described. When I try to “fetch records” for the given variable, I receive the following error:
Error in statement at line number 1
The Left expression is of type STRING and the right expression is of type BIGINT And the operator == is not valid here
Help!!!
Drew
The code still works
From your error code, I assume that u are trying to validate 2 diffrent fieldtypes.
it has to be NUMBER == NUMBER (or) STRING == STRING (or) DATE ==DATE… esentially, the same field type
I have the same problem when using lookup fields. They are all BIGINT, not strings. I get the same error (“Error in statement at line number 1
The Left expression is of type STRING and the right expression is of type BIGINT And the operator == is not valid here’). Is there a way to make a lookup a string, not a BIGINT?
Hi Mary where ID == BIGINT variable of appropriate colum from
This post is now outdated.. after ZC’s new user interface. I will post a new tutorial on how to use lookup field soon and keep u posted.
As for your question:
Q:Is there a way to make a lookup a string, not a BIGINT?
A: No.
The default is set to look up the recID (which is a BIGINT)
So, our sulution would be
–fetch records from
— get the
— Assign the string value to the parent form’s variable.
Deepa, is it possible to display a subform on a stateless form?
Hi Vin,
No, it is not possible to use subform in Statelss form
Reason:
subform records are tied to parent fom via Parent-form-record-ID and sub-form-record-ID
and stateless forms donot store data, so they donot have a recordID