Use parameter in Select Component
Hello everyone,
I want to fill data into my select component with sql request and parameter.
I tried to follow this example https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KE…
I need to call a method because my parameter can be different. I tried something like this but it doesn't work...
ClientMethod changeParams() [ Language = javascript ]{var query = zenPage.getComponentById('categorieBeneficiaire');query.setProperty('parameter', 1, 'OS');query.setProperty('parameter', 2, 'NSAL');
}or like this :
ClientMethod changeParams() [ Language = javascript ]{var query = zenPage.getComponentById('categorieBeneficiaire');var param1 = zenPage.getComponentById('catBParam1');var param2 = zenPage.getComponentById('catBParam2');param1.value='OS';param2.value='NSAL';
query.executeQuery();}You can see my select here :
<select id="categorieBeneficiaire" label="Catégorie bénéficiaire " sql="SELECT row FROM mytable where cond = ? and cond2= ?" required="true" > <parameter id="catBParam1" /> <parameter id="catBParam2" /></select>
Comments
Try
<FONT COLOR="#000080">ClientMethod </FONT><FONT COLOR="#000000">changeParams() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ]
{
</FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">query </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'categorieBeneficiaire'</FONT><FONT COLOR="#000000">);
</FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">param1 </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'catBParam1'</FONT><FONT COLOR="#000000">);
</FONT><FONT COLOR="#008080">var </FONT><FONT COLOR="#000000">param2 </FONT><FONT COLOR="#000080">= </FONT><FONT COLOR="#000000">zen(</FONT><FONT COLOR="#800000">'catBParam2'</FONT><FONT COLOR="#000000">);
param1.value</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'OS'</FONT><FONT COLOR="#000000">;
param2.value</FONT><FONT COLOR="#000080">=</FONT><FONT COLOR="#800000">'NSAL'</FONT><FONT COLOR="#000000">;
query.refreshContents();
}</FONT>
<FONT COLOR="#000080">/// This client event, if present, is fired when the page is loaded.
ClientMethod </FONT><FONT COLOR="#000000">onloadHandler() [ </FONT><FONT COLOR="#000080">Language </FONT><FONT COLOR="#000000">= javascript ]
{
zenPage.changeParams();
}</FONT>
It works ! Thank you