public
Created

Paste & execute this in your browser's js console when you're on a Zoho Creator form's scriptbuilder page.

  • Download Gist
zc_fields.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/**
* ZC fields render
*
* When on a Zoho Creator form scriptbuilder page, paste this into your javascript console
* (if on FF I recommend firebug) & execute it. This will render a DS code for all of the form fields
* DOUBLE CLICK the textarea created to remove it
*
* @param string m -Change to "insert","collect", or "update" to change the DS code output
* @param string r -Change to whatever you want your record collection variable to be
* @author Stephen Rhyne @srhyne
* @license whatever!
*/
 
var fields = [],m = "insert",r = "r",v,
methods = {
insert : function(v){
return v+" = input."+v+"\n";
},
collect : function(v){
return "input."+v+" = "+r+"."+v+";\n";
},
update : function(v){
return r+"."+v+"= input."+v+";\n";
}
};
$("table.referfields-item-table tr")
.slice(1)
.each(function(){
v = $(this).find("td input")[0].value;
fields.push(methods[m || "insert"](v));
});
$("<textarea />")
.css({
"position":"fixed",
"top":"0px",
"right" :"0px",
"width" : "500px",
"height" : "500px",
"overflow" :"auto",
"border" : "2px solid rgb(220,220,220)"
})
.dblclick(function(){
$(this).remove();
})
.text(fields.join("")).appendTo("body");

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.