Form Page Specification
The call to /formgenerator/get/ID_FORM1 must be done with in POST the md5 of the form page saved previously.
In case the form infos were changed the call returns the new infos, otherwise returns an empty string. In the last case should be used the cache data.
The Form Page is described by the following keys
{ form_datas:[], style:{ "text_color":"#000000", //default "text_alpha":1, "bg_bgcolor":"#FFFFFF", "bg_bgalpha":1 }, cache:true|false, buttons:{ "submit": { "text":"", "bg_bgcolor":"#F7F7F7", //default (era: bg_color) "bg_bgalpha":1, //(era: bg_alpha) "text_color":"#000000", "text_alpha":1 } } }
if cache is true the information set by the user has to be cache and reused when the form is opened again.
The md5 of the cache must be sent with a POST to /formgenerator/user_data/ID_FORM which returns the last user data if these were changed, otherwise returns an empty string.
In the last case the cached data should be used.
User_values
It is an JSON object with a series of key and value.
{ key:value }
Form_datas
[ { title:"", type:"", name:"", values:[{key:value}], vdefault:"", required:true|false } ]
Values
The values can be:
1) A json hash with a series of key and value (i.e.: {"M":"maschio","F":"femmina"}). The key indicates the variable value, the second one indicates the value of the variable to show.
2) A json array with 3 values (i.e.: [1 10 1]). These indicates the first value, the last value to show and the increment. In this case variable value and value to show are the same.
Vdefault
The vdefault indicates the default value for the forms' element (i.e.: "M").
Style
{ text_color:"#", text_alpha:"", bg_bgcolor:"#", bg_bgalpha:"" }
Field Type
The type key describe the type of the field it can have this values ( the default value is string value )
text
default one, the user have to insert a short text value
url
the user have to insert an url
number
the user have to insert a number
textarea
the user have to insert a medium/long text value
image
the user upload a image file on server.
audio
the user upload an audio file on server.
video
the user upload a video file on server.
date
the user have to insert a date string (Y-m-d)
datetime
the user have to insert a datetime string (Y-m-d H:i:s)
time
the user have to insert a time string (H:i:s)
checkbox | radio | select
the user should see the specific input type. The values of the inputs are founds in the values key that is an hash that contains the real value as the key and the value to show as the value.
1ID_FORM is a string and not a number.