Re: [Xsltforms-support] Cascading Dynamic Dropboxes (xf:select1). existdb templating framework
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2015-06-20 07:20:11
|
Hello! For populating the first select1, I guess that this code snippet will create a div element within the select1 element. This will not work with regular XForms engines. I would suggest to generate all the XForms control with the template instead of just the minimal chunk. Actually, it would be more in XForms approach to generate an instance and use itemset within the select1 control. For cascading dropboxes, for which XForms is naturally well designed, XForms bindings allow to specify conditions in between with XPath expressions. When an AJAX processing is required, again, XForms instances are well suited and XForms submissions are easy to manipulate. What do you think? --Alain Le 18/06/2015 12:42, Дмитрий Сураев a écrit : > > Hello everyone! > > I'm working with existdb XForm and its HTML Templating Module (xquery logic) > Trying to make two cascaded dropboxes: > > I. 1-st one loads data from database at XForm loading: > > <xf:select1 ref="Region" selection="open" appearance="minimal" incremental="true"> > <xf:label>Region: </xf:label> > <div data-template="app:get_regions"/> > </xf:select1> > > > xquery function "get_regions" in app module forms xf:item then processing XForm: > > declare > > function app:get_regions($node as node(), $model as map(*)) { > let $connection := sql:get-connection('oracle.jdbc.OracleDriver', 'my conn string') > > let $q1 := "select distinct RG from ds8test.VLANMAP_64 where mr = 'FE' and rg not like ' ' order by rg" > > let $qry := sql:execute( $connection, $q1, fn:true()) > > let $result := for $row at $pos in $qry//sql:row > let $rg := $row/sql:RG/text() > return > <xf:item> > <xf:label>{$rg}</xf:label> > <xf:value>{$rg}</xf:value> > </xf:item> > return $result > }; > > > II. The second dropbox should be populated with values, when any option is selected in dropbox 1 > > > Is it possible to do this by means of xquery functions? Or how should I do? > > Thank you! > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > |