Select List Hack
CompletedHi All,
Here's a quick hack that may come in handy sometime. If you want to set multiple values when selecting a single item from a select list - either to set labels or form inputs or even to pass parameters directly to an action refresh JavaScript or action report JavaScript, you can do this by populating your value column with a JavaScript Object. See the example report page below
<Report ID="SelectListHack" SavedBy="LOGIXML\gmcKenna" SavedAt="2021-10-18 17:05:30" EngineVersion="12.8.675-SP1">
<StyleSheet ID="ssBootstrap-431" StyleSheet="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" Theme="Silver" />
<Body>
<Division ID="divContainer" HtmlDiv="True" Class="container-fluid">
<Division ID="divSelectLists" HtmlDiv="True" Class="card p-4 m-4">
<InputGrid CaptionWidth="50" Layout="Auto" WidthScale="%" ID="igItems" GridWidth="100">
<InputSelectList OptionValueColumn="json_val" OptionCaptionColumn="item" ID="pItems" Caption="Item selector" IncludeBlank="True">
<DataLayer Type="Static" ID="StaticFour">
<StaticDataRow id="1" item="Hammer" json_val="{"make":"Stanley", "model":"HAMPIN001", "version":0.1}" />
<StaticDataRow id="2" item="Screwdriver Set" json_val="{"make":"Silverline", "model":"SCREWELEC002", "version":"2.3"}" />
<StaticDataRow id="3" item="Tenon saw" json_val="{"make":"Total", "model":"SAWTEN001", "version":"0.3"}" />
<StaticDataRow id="4" item="No 4 Plane" json_val="{"make":"Stanley", "model":"PLANE04001", "version":"0.1"}" />
<StaticDataRow id="5" item="Pin nails 25mm x 50" json_val="{"make":"Challenge", "model":"PIN25X50001", "version":"0.1"}" />
<DataLayerLink ID="dllStaticOne" />
</DataLayer>
<EventHandler DhtmlEvent="onchange">
<Action Type="Javascript" ID="actSetValues" Javascript="var xVal = JSON.parse(this.value); document.getElementById("pMake").value = xVal.make; document.getElementById("pModel").value = xVal.model; document.getElementById("pVersion").value = xVal.version; " />
</EventHandler>
</InputSelectList>
<InputText ID="pMake" Caption="Make" />
<InputText ID="pModel" Caption="Model" />
<InputText ID="pVersion" Caption="Version" />
</InputGrid>
</Division>
</Division>
</Body>
</Report>
1
Please sign in to leave a comment.
Comments
0 comments