xforms - Changing values dynamically in XsltForms controls -
i'm trying control input values javascript. need autocomplete "not-enabled inputs" depending on other variables.
the first try manipulate dom getting reference control, auto-generated html code not formed, can not use regex, or query selectors or simple getelementbyid(). see example > http://jsfiddle.net/wmzyqqja/7/
the second try modify data model, failed trying specifying path (i think so). having model:
<xf:model id="mod"> <xf:instance id="people"> <person name=""/> </xf:instance> <xf:instance id="tmpperson"> <person name=""/> </xf:instance> <xf:bind nodeset="instance('tmpperson')/@name" readonly="true()" /> </xf:model>
i used functions no sucess:
function changevalue(){ var ctx = xf_getinstance('mod', 'tmpperson'); console.log('ctx: ' + ctx); var reg = 'person'; // /tmpperson/person --> null // /model/instance/person --> null // //model/instance/person // /mod/tmpperson/person --> null // //mod/tmpperson/person --> null // /person var node = xf_getnode(ctx, reg); console.log('node: ' + node); //node null xf_changenode( node, 'new value' ); tri function xf_getnode(context, path) { return xsltforms_browser.selectsinglenode(path, context); } function xf_changenode(node, value) { xsltforms_globals.openaction("xsltforms_change"); xsltforms_browser.setvalue(node, value || ""); document.getelementbyid(xsltforms_browser.getmeta(node.ownerdocument.documentelement, "model")).xfelement.addchange(node); xsltforms_browser.debugconsole.write("setvalue " + node.nodename + " = " + value); xsltforms_globals.closeaction("xsltforms_change"); }
this live demo > http://www.devel-open.org/xsltforms/demo/changing-values-dynamically.xml
any ide how can manage that? need modify values. in advance!
there namespace issue instances: default namespace html. please try again adding xmlns=""
within them.
Comments
Post a Comment