xForms:输入不显示在浏览器中 [英] xForms:Input doesn't show in browser

查看:28
本文介绍了xForms:输入不显示在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 xForms:input,但它们没有显示在浏览器中.这是我的 xhtml 代码:

I'm trying to use xForms:input, but them don't show in Browser. Here is my xhtml code:

<?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 不起作用.

You can see that i'm using HTML , because this xForms doesn't working.

当我点击提交按钮时,这也不起作用,也许这就是原因.

When i click on the submission button, this doesn't working too, maybe this is the reason.

您能帮我找到xForms 不显示在浏览器中的解决方案吗?

You can help me to find a solution to xForms doesn't show in the browser?

推荐答案

正如其他人所指出的,当前的 Web 浏览器本身并不支持 XForms.您需要一些 XForms 实现来使表单工作.XHTML 中嵌入的 XForms 通常有两种实现方式:

As others have pointed out, current web browsers do not support XForms natively. You will need some XForms implementation to make your forms work. There are in general two kinds of implementations for XForms embedded in XHTML:

  • 浏览器端实现.

  • Browser-side implementations.

这里的一个突出例子是 XSLTForms,它由 AgenceXML 的 Alain Couthures 开发.安装和使用非常简单:将库安装在 Web 服务器上并从表单中引用 XSLTForms 样式表.样式表使用用户 Web 浏览器中的 XSLT 引擎来构建表单的 HTML + Javascript 版本.

A prominent example here is XSLTForms, developed by Alain Couthures of AgenceXML. Very simple installation and use: you install the library on your Web server and refer to the XSLTForms stylesheet from your form. The stylesheet uses the XSLT engine in the user's web browser to build an HTML + Javascript version of the form.

旧的 X-Smiles 独立浏览器和用于 XForms 的 Mozilla 插件是此类的进一步示例,但据我所知,现在都没有维护.

The old X-Smiles free-standing browser and the Mozilla plugin for XForms were further examples of this class, but as far as I know neither is now maintained.

服务器端实现.

突出的例子包括 Orbeon 和 BetterForms.当对 XForm 的请求传入时,服务器上的代码会生成一个带有嵌入式 Ajax 调用的 HTML 页面.有些事情是在 Web 浏览器中执行的,而另一些是在服务器上执行的(作为 XForms 的作者,您是看不到的).在服务器代码中,实现者比在客户端上运行的 Javascript 有更多的自由,所以我的印象是为这些实现添加新功能更容易.Orbeon 和 BetterForms 都有令人印象深刻的文档.

Prominent examples include Orbeon and BetterForms. When a request for an XForm comes in, code on the server generates an HTML page with embedded Ajax calls. Some things are executed in the web browser and others on the server (not visible to you as XForms author). In server code the implementors have more of a free hand than in Javascript to be run on the client, so I have the impression that adding new features is easier for these implementations. Both Orbeon and BetterForms have impressive documentation.

BetterForms 和 XSLTForms 都是 eXist XML 数据库包的一部分.因此,可以通过这种方式避免一些安装问题.我最后一次查看时,eXist 与 Orbeon 打包在一起.

Both BetterForms and XSLTForms come as part of the eXist XML database package. So some installation issues can be avoided that way. And the last time I looked, eXist came packaged with Orbeon.

W3C XForms wiki 上的活动实现列表有指向这些和其他实现的指针.

The list of active implementations on the W3C XForms wiki has pointers to these and other implementations.

这篇关于xForms:输入不显示在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆