xForms:Input doesn't show in browser

╄→гoц情女王★ 提交于 2019-12-25 09:19:52

问题


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>

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.

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


回答1:


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.

    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.

    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.

  • Server-side implementations.

    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.

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.

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




回答2:


Nowadays Xforms is not supported by browsers, thats why you can't see anything of your form. Maybe you could try to use Orbeon. Orbeon Forms is a solution to build and deploy web forms. You must deploy it in your server to use Xforms.



来源:https://stackoverflow.com/questions/44474877/xformsinput-doesnt-show-in-browser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!