Xpath 设置值和绑定问题:值设置为空值
我正在设计一个XForm搜索表单。这是我的密码Xpath 设置值和绑定问题:值设置为空值,xpath,bind,xforms,Xpath,Bind,Xforms,我正在设计一个XForm搜索表单。这是我的密码 <?xml version="1.0" encoding="ASCII"?> <xhtml:html xmlns:xhtml="http://www.w3.org/2002/06/xhtml2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2
<?xml version="1.0" encoding="ASCII"?>
<xhtml:html xmlns:xhtml="http://www.w3.org/2002/06/xhtml2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xforms:model id="auctionItems">
<xforms:instance id="auctions">
<foo>
<request>
<criterias relation="AND">
<criteria name="CritCallCustomerLastName" operator="Equal" model="CustomerLastName" gui_display="Customer LastName"><value></value><value></value></criteria>
</criterias>
</request>
<dataStore>
<store name="CritCallCustomerLastName1"/>
<store name="CritCallCustomerLastName2"/>
</dataStore>
</foo>
</xforms:instance>
<xforms:bind id="bindCallCustomerLastName1" required="false()" type="xforms:string" nodeset="/foo/dataStore/store[@name='CritCallCustomerLastName1']"/>
<xforms:bind id="bindCallCustomerLastName2" required="false()" type="xforms:string" nodeset="/foo/dataStore/store[@name='CritCallCustomerLastName2']"/>
<xforms:submission id="search" ref="/foo" replace="none"/>
<xforms:submission id="order" ref="/foo" replace="none"/>
</xforms:model>
<xhtml:body>
<xhtml:div class="form-horizontal">
<xhtml:div style="margin-left: 10px">
<xhtml:fieldset>
<xhtml:legend>Phone Calls</xhtml:legend>
<xhtml:div class="control-group">
<xhtml:label class="control-label">Customer Last Name</xhtml:label>
<xhtml:div class="controls">
<xforms:input bind="bindCallCustomerLastName1" id="input_call_customer_last_name" class="input-large">
<xforms:hint>Customer Last Name 1</xforms:hint>
</xforms:input>
<xforms:input bind="bindCallCustomerLastName2" id="input_call_customer_last_name" class="input-large">
<xforms:hint>Customer Last Name 2</xforms:hint>
</xforms:input>
</xhtml:div>
</xhtml:div>
</xhtml:fieldset>
</xhtml:div>
<xforms:repeat nodeset="request/criterias/criteria" id="repeatAuctionItems">
<xhtml:div class="form-actions">
<xhtml:span class="pull-right">
<xforms:trigger>
<xforms:label>Search</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:send submission="search"/>
<xforms:setvalue ref="/value[1]" value="../../../dataStore/store[@name='CritCallCustomerLastName1']" />
<xforms:setvalue ref="/value[2]" value="../../../dataStore/store[@name='CritCallCustomerLastName2']" />
</xforms:action>
</xforms:trigger>
<xforms:submit submission="search">
<xforms:label>Submit</xforms:label>
</xforms:submit>
</xhtml:span>
</xhtml:div>
</xforms:repeat>
</xhtml:div>
</xhtml:body>
</xhtml:html>
电话
客户姓氏
客户姓氏1
客户姓氏2
搜寻
提交
这张表格大部分是按照它写的那样做的。我们将输入输入到两个输入中,然后通过绑定设置数据存储中的两个存储节点
然后单击搜索按钮,但是似乎从未调用setvalue,并且没有设置请求/准则/准则中的值节点
知道我做错了什么吗?所以问题如下: 原始设置值:
<xforms:setvalue ref="/value[1]" value="../../../dataStore/store[@name='CritCallCustomerLastName1']" />
<xforms:setvalue ref="/value[2]" value="../../../dataStore/store[@name='CritCallCustomerLastName2']" />
解决办法是:
<xforms:setvalue ref="value[1]" value="../../../../dataStore/store[@name='CritCallCustomerLastName1']" />
<xforms:setvalue ref="value[2]" value="../../../../dataStore/store[@name='CritCallCustomerLastName2']" />
该实例是criteria节点,因此ref应该是“value[*]”,而该值指向value节点,因此我们必须提升一个额外的级别