Not logged in

API Documentation

API If you have a website, you can use this API to retrieve virtually any information from your event and put it in your webpage.
The API is available

It offers endless possibilities, from image repositories to content manageable pages.

The use of the API involves inserting a DIV in your html with a class 'castaform' and the 36 digit event key and an attribute 'data-query' which is an (MS)SQL query.
The content of the div should be empty, because it will be replaced by the result of the query.

Note that only fields can be retrieved which are explicitly set to be viewed publicly,
which you can do in the Form Editor > double click on an input control > On Result Page > Always show.
Also, formula fields cannot be retrieved this way at this moment.

For more info about SQL SELECT queries, click here

See an example here




See an example of a complete content manageable website made with just a few lines of code here




You can even use information from other events in a website like the one above
by adding castaform divs as (part of) the content, demonstrated here
Used like this, different (power) users can update different parts of the website.

Syntax <div class="castaform event_key" data-query="sql_qyery|print_pattern|lastrow_print_pattern|before-html|after_html"></div>

event_key: a 36 digit unique event_key of your event

sql_query: a valid (MS)SQL select query on the table 'castaform'
Example: select top 5 {name},{city} from castaform
Note: in CastaForm, field names have to be placed between curly brackets

print_pattern: if omitted or empty, the output will be as a table and the rest of the parmeters will be ignored; else placeholders {*} are replaced by result fields.
Example: {*} ({*})<br>

lastrow_print_pattern: Optional, print pattern for the last row. If ommitted or empty, then the same pattern as the rest will be used
Example: and last but not least {*} ({*})<br>

before_ and after_html: Optional HTML to be included before or after the result.
Example: select distinct {country} from castaform|<li>{*}</li>||<ul>|</ul>

SQL Examples all examples are on the example tables 'Hotels in Indochina' or 'CastaForm pics'
description query in action
Get a list of countries. Since we don't specify a print pattern, the output will be in table form select distinct {country} from castaform show
specifying a print pattern select count(*) from castaform|We have {*} hotels show
a table with more fields select {name} as Hotel,{address} as Address from castaform where {city}='chiang rai' order by {name} show
specifying a print pattern and wrap it in an ordered list: select distinct {country} from castaform|<li>{*}</li>||<ol>|</ol> show
specifying a print pattern and a pattern for the last row select distinct {country} from castaform|{*}, |and last but not least {*}.
specifying a print pattern for multiple fields select {country},count({name}) from castaform group by {country}|{*} ({*}), | and last but not least {*} ({*})
Retrieving an image select {image} from castaform where {caption}='ba be'|{*} click me!
Retrieving a random image select top 1 {image},{caption} from castaform order by newID()|{*}<br />{*} show
Retrieving multiple images select top 5 {image} from castaform|{*} show

When using a table as output, the following style classes are applied:

<th>casta_th + column number
<td>casta_td + column number

All these style classes are empty, you have to write your own styles.
<style type='text/css'>
   .casta_table {border:1px solid, #dddddd;}




generates the div content based on the query for divs that have not been processed previously


Changes a div to become a CastaForm query result


execute the query again


always called when a div is filled with the result of a query

this is an empty function, define your own when necessary e.g.

castform.finished = function(somediv) {'inline-block'

All images have an onclick event defined: castaform.showPic(imgObject,bigImageSrc) which is empty.
You can define your own function here e.g.

castaform.showPic=function(img,src) {

Upon the onload event of an image, the function castaform.onPicLoad(imgObject,bigImageSrc) is called which is empty.
You can define your own function here e.g.

castaform.onPicLoad=function(img,src) {