(By the way, I’m not an automated documentation-writing troll, despite popular clamor and evidence to the contrary.) Okay, this is also a good question, and while the solutions are not “ideal”, we use them both often and have no qualms about recommending them. SOLUTION 1: Define your inputs as real fields in Salesforce. This one’s obvious, but I’m putting it here just for posterity and to reassure people that you don’t have to do Solution 2 to make this work. SOLUTION 2: Use a Custom Field Renderer. These things are magical, and for JavaScript junkies, they take Skuid to a whole different level. Basically, drag in an old actual field, e.g. the Id field, on your regular Model, into your Field Editor or Table, and then change its Label to your desired label, and set Field Renderer to “Custom (Run Snippet)”, and then enter “FakeInput” as the Snippet name: Then add the following JavaScript Resource of type “Inline (Snippet)”:
var field = arguments[0], value = '', // We could set a default value here, if we want $ = skuid.$; var fieldId = 'MyFakeField__c'; // Define custom metadata for our fake field, // so that Skuid knows how to run it. var metadata = { id: fieldId, displaytype: 'PICKLIST', accessible: true, createable: true, editable: true, // If set to true, // then the default option should be chosen required: false, picklistEntries: [ { value: 'Option1', label: 'Option 1', active: true, defaultValue: true }, { value: 'Option2', label: 'Option 2', active: true, defaultValue: false }, { value: 'Option3', label: 'Option 3', active: true, defaultValue: false } ] }; // Add our fake metadata to our fields map if (!field.model.fieldsMap[fieldId]) { field.model.fields.push(metadata); field.model.fieldsMap[fieldId] = metadata; } field.metadata = metadata; field.mode = 'edit'; // Run the standard renderer skuid.ui.fieldRenderers[metadata.displaytype][field.mode](field,value);
Let me explain what’s going on here. Custom Field renderers get handed a skuid.ui.Field object representing the Input Field on the page. skuid.ui.fieldRenderers is documented in the skuid.ui object docs and allows you to run a Skuid Ui Renderer for any DisplayType, e.g. PICKLIST, CURRENCY, REFERENCE, TEXTAREA, etc., for a particular Mode, e.g. read, readonly, edit, on a particular skuid.ui.Field object, with a given starting value. So all we’re doing here that’s “weird” is that we’re defining the Field’s Metadata here in JavaScript rather than retrieving it from Salesforce. So here we’re doing a Picklist Field, adding 3 Options to it, making it not-required, etc. So here’s what it looks like: