Created
October 29, 2010 06:15
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!