Skip to content

Instantly share code, notes, and snippets.

@srhyne
Created October 29, 2010 06:15
Show Gist options
  • Save srhyne/653013 to your computer and use it in GitHub Desktop.
Save srhyne/653013 to your computer and use it in GitHub Desktop.
Paste & execute this in your browser's js console when you're on a Zoho Creator form's scriptbuilder page.
/**
* 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");
@fdrobidoux
Copy link

Was really excited when I saw this, but then it turns out 6-years old code won't work on the newest version of ZohoCreator... d'oh!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment