One clearly missing feature in Zoho Creator forms is buttons! I have made many forms where I wanted to have a little button to "Calculate" or to "Fetch data", but was left with using a Decision field, which sometimes was unclear to the users. Recognise this? Then look no further! Buttons can be made by restyling components such as Decision and Radio fields, and I'll show you how!
A single button is made using a Decision field. The following snippet changes all decision fields into buttons. If you only want to change a specific field, you need to add the specific group class to the code. You can look for the correct class using the Inspector tool in Chrome, or an equivalent in any other browser. Another way is to look at the Field link name in the form designer. In this case, this name is "Calculate". The class is then zc-Calculate-group. In the snippet below, add it in this way to the three classes (decision-box-field and 2 times decision-box-label) like this: ".zc-Calculate-group .decision-box-field" and ".zc-Calculate-group .decision-box-label". Make sure you do this correctly: mind the two points and that there's a space in between them.
- hide styling;
- css = "<style>";
- css = css + ".decision-box-field {display:none;} .decision-box-label{ left: -20px; background-color:#228B22; border-color:#228B22; border-width:1px; border-style:solid; color:white !important; border-radius: 2px; padding: 5px 10px !important; font-weight:400 !important; font-size:14px !important;}";
- css = css + ".decision-box-label:hover{ background-color:#FFFFFF; color:#228B22 !important;}";
- css = css + "</style>";
- input.styling = css;
This snippet changes this Calculate Decision field:
To this: (left normal, right when hovering over it)
So how does the code snippet work? Let's break it down. First for the button itself, which is line 3:
- .decision-box-field {display:none;} This part hides the checkbox, so that only the label (text) remains. As you can click on both the box and the label to activate the Field, this is no problem.
--> 
- .decision-box-label{ left: -20px; The box is now hidden, but the label did not move. We move it 20 pixels to the left, to align with the other fields.

- background-color:#228B22; border-color:#228B22; border-width:1px; border-style:solid; We now give the background a color and add a 1 pixel wide solid border of the same color to it. The border is added here, as I added a border to the hovered button as well. If I wouldn't do this, the size of the button would change while hovering over it, moving the form below it by 2 pixels (the with of the top and bottom border combined) each time.

- color:white !important; Change the text color to white, to make it easier to read than black. Sometimes, you need to add the !important, as otherwise another stylesheet overrules this one.

- border-radius: 2px; Added a small radius to the border for rounded edges

- padding: 5px 10px !important; With this, you give the text some padding, to make it a nice, big button

- font-weight:400 !important; I made the font a little less bold

- font-size:14px !important;}"; And finally I made the font a little bit larger

Then, line 4 changes the button when you hover your mouse over it. The only changes that really happen is that it the background color and the text color change. It does it like so:
- .decision-box-label:hover This part says to the browser that it only needs to be applied when the mouse hovers over the button.
- background-color:#FFFFFF; color:#228B22 !important;}"; And the rest changes the background color to white (#FFFFFF is the hex notation of white, so they both work) and the text color to forest green.
Having a row of multiple buttons to select something with works in roughly the same way as with the single button explained above here. But there are a few differences! First, the general snippet of building the CSS part:
Related Articles
Create a European VAT ID checker (also works for Zoho CRM!)
For invoicing to other businesses within the EU, it is mandatory to check whether the VAT ID of your customer is correct, in order to invoice using a 0% tax rate. I wrote a script that checks the VAT number that you have from your customer against ...
Limitations in CSS styling
Styling forms in Zoho Creator using CSS styling in a Notes field brings many possibilities, but unfortunately not all CSS properties and functions work: some are simply stripped out. Whenever I come across a limitation, I add it to the list below, ...
Sending images to imagekit.io using API
imagekit.io is a service for optimising media content for websites. It's API is pretty straightforward, but it's always a bit finicky to get a connection going the way you want it. To make an API call, first follow the steps in "Authorisation" and ...
Add a custom logo to an app
Zoho Creator gives you a couple of options for the logo that is displayed in the top left corner of an app: Your company logo (the same for all your apps) An icon from the predefined icon list A 1-3 letter combination Now, you might have different ...
Creating a Function
When you have a piece of scripting code that you use frequently, it can be better to create a function for this. Instead of copying this piece of code (and having to update each and every instance when you need to change it!), you have it in one ...