我正在尝试使用xForms:input,但它们不能在浏览器中显示。下面是我的xhtml代码:
<?xml-model href="http://www.oxygenxml.com/1999/xhtml/xhtml-xforms.nvdl"
schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<meta:meta xmlns:meta="http://www.xsmiles.org/2002/metadata"
name="XForms Controls"
description="Tests all XForms controls in single document"/>
<head>
<title>Registo de Utilizador</title>
<xforms:model id="modelUtilizador">
<xforms:instance
id="instanceUtilizador"
src="http://localhost:8081/exist/apps/PEIFinal/data/utilizadores.xml"/>
<xforms:bind id="nome" nodeset="//utilizador/nome" type="xsd:string" required="true()"/>
<xforms:bind id="sexo" nodeset="//utilizador/sexo" type="xsd:string"/>
<xforms:bind id="rua" nodeset="//utilizador/rua" type="xsd:string" required="true()"/>
<xforms:bind id="nporta" nodeset="//utilizador/nPorta" type="xsd:integer" required="true()"/>
<xforms:bind id="codPost1" nodeset="//utilizador/codPost1" type="xsd:integer"/>
<xforms:bind id="codPost2" nodeset="//utilizador/codPost2" type="xsd:integer" required="true()"/>
<xforms:bind id="distrito" nodeset="//utilizador/distrito" type="xsd:string" required="true()"/>
<xforms:bind id="pais" nodeset="//utilizador/pais" type="xsd:string" required="true()"/>
<xforms:bind id="telefone" nodeset="//utilizador/telefone" type="xsd:string" required="true()"/>
<xforms:bind id="email" nodeset="//utilizador/email" type="xsd:string" required="true()"/>
<xforms:bind id="username" nodeset="//utilizador/username" type="xsd:string" required="true()"/>
<xforms:bind id="password" nodeset="//utilizador/password" type="xsd:string" required="true()"/>
<xforms:submission action="http://google.com" id="s001" method="post"/>
</xforms:model>
</head>
<body>
<fieldset>
<xforms:input bind="nome">
<xforms:label> Nome </xforms:label>
<legend/>
<input class="texttoNome" type="text" name="nome"/>
</xforms:input>
<xforms:input bind="sexo">
<xforms:label> Sexo <input class="texttoSexo" type="checkbox" name="sexo"/>
</xforms:label>
</xforms:input>
<xforms:input bind="rua">
<xforms:label> Rua </xforms:label>
<input class="texttoRua" type="text" name="rua"/>
</xforms:input>
<xforms:input bind="nporta">
<xforms:label> Porta </xforms:label>
<input class="texttoPorta" type="text" name="porta"/>
</xforms:input>
<xforms:input bind="codPost1">
<xforms:label> CodigoPostal </xforms:label>
<input class="texttocodPost1" type="text" name="codPost1"/>
</xforms:input>
<xforms:input bind="codPost2">
<xforms:label> </xforms:label>
<input class="texttocodPost2" type="text" name="codPost2"/>
</xforms:input>
<xforms:input bind="distrito">
<xforms:label> Distrito </xforms:label>
<input class="texttodistrito" type="text" name="distrito"/>
</xforms:input>
<xforms:input bind="pais">
<xforms:label> País </xforms:label>
<input class="texttopais" type="text" name="pais"/>
</xforms:input>
<xforms:input bind="telefone">
<xforms:label> Telefone </xforms:label>
<input class="texttotelefone" type="text" name="telefone"/>
</xforms:input>
<xforms:input bind="email">
<xforms:label> Email </xforms:label>
<input class="texttoemail" type="text" name="email"/>
</xforms:input>
<xforms:input bind="username">
<xforms:label> Username </xforms:label>
<input class="texttousername" type="text" name="username"/>
</xforms:input>
<xforms:input model="modelUtilizador" bind="password">
<xforms:label> Password </xforms:label>
</xforms:input>
<xforms:submit submission="s001">
<xforms:label>Registar</xforms:label>
</xforms:submit>
</fieldset>
</body>
</html>您可以看到我使用的是HTML语言,因为这个xForms不起作用。
当我点击提交按钮时,这也不起作用,也许这就是原因。
你能帮我找到一个xForms不在浏览器中显示的解决方案吗?
发布于 2017-09-21 02:48:45
正如其他人指出的那样,当前的web浏览器本身并不支持XForms。您需要一些XForms实现才能使表单正常工作。嵌入在XHTML中的XForms通常有两种实现:
旧的X-Smiles独立浏览器和XForms的Mozilla插件是这个类的另一个例子,但据我所知,现在这两个都没有维护。
BetterForms和XSLTForms都是eXist XML数据库包的一部分。因此,可以通过这种方式避免一些安装问题。我最后一次看的时候,eXist是和Orbeon一起来的。
W3C XForms维基上的list of active implementations有指向这些和其他实现的指针。
发布于 2017-06-11 23:45:23
现在浏览器不支持Xforms,这就是为什么您看不到表单的原因。也许你可以尝试使用Orbeon。Orbeon forms是一个构建和部署web表单的解决方案。您必须将其部署到服务器中才能使用Xforms。
https://stackoverflow.com/questions/44474877
复制相似问题