0
votes

I'm trying to run xForms on browser but its not show in Browser. Here is my xml code:

<xforms>

<model>
  <instance>
  <person>
    <fname/>
    <lname/>
  </person>
  </instance>
  <submission id="form1" method="get"
   action="submit.asp"/>
</model>

<input ref="fname">
<label>First Name</label></input><br />

<input ref="lname">
<label>Last Name</label></input><br /><br />

<submit submission="form1">
<label>Submit</label></submit>
</xforms>

also, I want to know which engine should I use to run XForms.

Thanks in advance

1
XForms is a thing of the distant past when XHTML was envisioned. It isn't, and never was, supported by regular Web browsers. If you absolutely want to use it, you may have luck with XSLTForms, Orbeon, and other old, open-sourced XForms code bases. - imhotap

1 Answers

2
votes

Until some JavaScript framework gets mature enough to be close to XForms, you can use XForms with a plugin like XLSTForms

Just download it, and unpack in XSLTForms folder under your webpage.

Add this processing instruction at top of your page:

<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>

Change the element to add namespace declaration:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/01/xforms">

And prefix all your XForms elements with xf: like this

<xf:model>
  <xf:instance>
  <person xmlns="">
    <fname/>
    <lname/>
  </person>
  </xf:instance>
  <xf:submission id="form1" method="get" action="submit.asp"/>
</xf:model>

<xf:input ref="fname">
  <xf:label>First Name</xf:label>
</xf:input><br />

<xf:input ref="lname">
  <xf:label>Last Name</xf:label>
</xf:input><br /><br />

<xf:submit submission="form1">
  <xf:label>Submit</xf:label>
</xf:submit>

You could find more documentation at the XSLTForms Wikibook