2016-01-28 20 views
0

此按钮的默认行为始终处于启用状态,如果某个字段是强制性的或不正确的,则会显示错误。在orben中可以隐藏或禁用“发送”按钮,直到表单完成为止?

但是,如果您使用向导,并且必须填写不同的部分,则如果您仍然处于表单的开头部分,则提交表单并不正常。可能你必须导航到所有部分填写所有问题(至少是强制性的),直到你到达最后一节。当你在最后一节时,你可以提交表格。至少,强制用户阅读所有表单。

我知道这是一个有点讨厌这种行为,特别是与Orbeon没有太多经验的用户,他们倾向于按下这个按钮,当他们完成第一节。

然后问题是:有什么方法隐藏或禁用“发送”按钮,直到到达最后一节?

编辑

documentation page所示Orbeon的新版本2016.1终于隐藏 “提交” 按钮。至少,本文显示如下:

向导改进。向导的目录表示错误更清楚的页面。在验证模式下,无法导航到的页面也更好。 最后但并非最不重要,在验证模式下,向导中显示的保存,提交,发送和其他按钮仅在用户到达向导的最后一页时才会显示。最后,我们也做了一些美容改进。

我想这个新功能使验证模式,在属性文件:

<!-- Configure wizard layout --> 
<property as="xs:string" name="oxf.fr.detail.view.appearance.*.*" value="wizard"/> 
<property as="xs:boolean" name="oxf.xforms.xbl.fr.wizard.validate.*.*" value="true"/> 

而且我使用窗体生成器创建一个简单的表格:

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:ev="http://www.w3.org/2001/xml-events" 
    xmlns:xi="http://www.w3.org/2001/XInclude" 
    xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" 
    xmlns:xxf="http://orbeon.org/oxf/xml/xforms" 
    xmlns:exf="http://www.exforms.org/exf/1-0" 
    xmlns:fr="http://orbeon.org/oxf/xml/form-runner" 
    xmlns:saxon="http://saxon.sf.net/" 
    xmlns:sql="http://orbeon.org/oxf/xml/sql" 
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:fb="http://orbeon.org/oxf/xml/form-builder"> 
<xh:head> 
    <xh:title>Wizard Test</xh:title> 
    <xf:model id="fr-form-model" xxf:expose-xpath-types="true"> 

     <!-- Main instance --> 
     <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id"> 
      <form> 
       <section-1> 
        <control-2/> 
        <control-3/> 

       </section-1> 
       <section-4> 
        <control-5/> 
        <control-6/> 
       </section-4> 
       <section-7> 
        <control-8/> 
       </section-7> 
      </form> 
     </xf:instance> 

     <!-- Bindings --> 
     <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')"> 
      <xf:bind id="section-1-bind" name="section-1" ref="section-1"> 
       <xf:bind id="control-2-bind" ref="control-2" name="control-2" required="true()"/> 
       <xf:bind id="control-3-bind" ref="control-3" name="control-3"/> 

      </xf:bind> 
      <xf:bind id="section-4-bind" ref="section-4" name="section-4"> 
       <xf:bind id="control-5-bind" ref="control-5" name="control-5" required="true()"/> 
       <xf:bind id="control-6-bind" ref="control-6" name="control-6"/> 
      </xf:bind> 
      <xf:bind id="section-7-bind" ref="section-7" name="section-7"> 
       <xf:bind id="control-8-bind" ref="control-8" name="control-8" type="xs:boolean" 
         required="true()"/> 
      </xf:bind> 
     </xf:bind> 

     <!-- Metadata --> 
     <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all"> 
      <metadata> 
       <application-name>WizardTest</application-name> 
       <form-name>WizardTest</form-name> 
       <title xml:lang="en">Wizard Test</title> 
       <description xml:lang="en"/> 
       <singleton>false</singleton> 
      </metadata> 
     </xf:instance> 

     <!-- Attachments --> 
     <xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all"> 
      <attachments> 
       <css mediatype="text/css" filename="" size=""/> 
       <pdf mediatype="application/pdf" filename="" size=""/> 
      </attachments> 
     </xf:instance> 

     <!-- All form resources --> 
     <xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all"> 
      <resources> 
       <resource xml:lang="en"> 
        <control-8> 
         <label>Yes or no?</label> 
         <hint/> 
        </control-8> 
        <control-5> 
         <label>Radio Button Other</label> 
         <hint/> 
         <item> 
          <label>First choice</label> 
          <value>1</value> 
          <hint/> 
         </item> 
         <item> 
          <label>Second choice</label> 
          <value>2</value> 
          <hint/> 
         </item> 
         <item> 
          <label>Third choice</label> 
          <value>3</value> 
          <hint/> 
         </item> 
        </control-5> 
        <control-6> 
         <label>Select</label> 
         <hint/> 
         <item> 
          <label>First choice</label> 
          <value>1</value> 
         </item> 
         <item> 
          <label>Second choice</label> 
          <value>2</value> 
         </item> 
         <item> 
          <label>Third choice</label> 
          <value>3</value> 
         </item> 
        </control-6> 
        <control-2> 
         <label>Radio Button</label> 
         <hint/> 
         <item> 
          <label>First choice</label> 
          <value>1</value> 
          <hint/> 
         </item> 
         <item> 
          <label>Second choice</label> 
          <value>2</value> 
          <hint/> 
         </item> 
         <item> 
          <label>Third choice</label> 
          <value>3</value> 
          <hint/> 
         </item> 
        </control-2> 
        <control-3> 
         <label>Radio Button Other</label> 
         <hint/> 
         <item> 
          <label>First choice</label> 
          <value>1</value> 
          <hint/> 
         </item> 
         <item> 
          <label>Second choice</label> 
          <value>2</value> 
          <hint/> 
         </item> 
         <item> 
          <label>Third choice</label> 
          <value>3</value> 
          <hint/> 
         </item> 
        </control-3> 
        <section-1> 
         <label>Untitled Section</label> 
        </section-1> 
        <section-4> 
         <label>Section2</label> 
         <help/> 
        </section-4> 
        <section-7> 
         <label>Section3</label> 
         <help/> 
        </section-7> 

       </resource> 
      </resources> 
     </xf:instance> 

     <!-- Utility instances for services --> 
     <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all"> 
      <request/> 
     </xf:instance> 

     <xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all"> 
      <response/> 
     </xf:instance> 

    </xf:model> 
</xh:head> 
<xh:body> 
    <fr:view> 
     <fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline" 
       xmlns:oxf="http://www.orbeon.com/oxf/processors"> 
      <fr:section id="section-1-control" bind="section-1-bind"> 
       <xf:label ref="$form-resources/section-1/label"/> 
       <fr:grid> 
        <xh:tr> 

         <xh:td> 
          <xf:select1 id="control-2-control" appearance="full" bind="control-2-bind"> 
           <xf:label ref="$form-resources/control-2/label"/> 
           <xf:hint ref="$form-resources/control-2/hint"/> 
           <xf:alert ref="$fr-resources/detail/labels/alert"/> 


           <xf:itemset ref="$form-resources/control-2/item"> 
            <xf:label ref="label"/> 
            <xf:value ref="value"/> 
            <xf:hint ref="hint"/> 
           </xf:itemset> 
          </xf:select1> 
         </xh:td> 
        </xh:tr> 
        <xh:tr> 
         <xh:td> 
          <fr:open-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-3-control" 
              bind="control-3-bind"> 
           <xf:label ref="$form-resources/control-3/label"/> 
           <xf:hint ref="$form-resources/control-3/hint"/> 

           <xf:alert ref="$fr-resources/detail/labels/alert"/> 
           <xf:itemset ref="$form-resources/control-3/item"> 
            <xf:label ref="label"/> 
            <xf:value ref="value"/> 
            <xf:hint ref="hint"/> 
           </xf:itemset> 
          </fr:open-select1> 
         </xh:td> 
        </xh:tr> 
       </fr:grid> 
      </fr:section> 
      <fr:section id="section-4-control" bind="section-4-bind"> 
       <xf:label ref="$form-resources/section-4/label"/> 
       <fr:grid> 
        <xh:tr> 
         <xh:td> 
          <fr:open-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="control-5-control" 
              bind="control-5-bind"> 
           <xf:label ref="$form-resources/control-5/label"/> 
           <xf:hint ref="$form-resources/control-5/hint"/> 
           <xf:alert ref="$fr-resources/detail/labels/alert"/> 


           <xf:itemset ref="$form-resources/control-5/item"> 
            <xf:label ref="label"/> 
            <xf:value ref="value"/> 
            <xf:hint ref="hint"/> 
           </xf:itemset> 
          </fr:open-select1> 
         </xh:td> 
        </xh:tr> 
        <xh:tr> 
         <xh:td> 
          <fr:box-select xmlns="http://orbeon.org/oxf/xml/form-builder" 
              xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" 
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
              id="control-6-control" 
              bind="control-6-bind"> 
           <xf:label ref="$form-resources/control-6/label"/> 
           <xf:hint ref="$form-resources/control-6/hint"/> 

           <xf:alert ref="$fr-resources/detail/labels/alert"/> 
           <xf:itemset ref="$form-resources/control-6/item"> 
            <xf:label ref="label"/> 
            <xf:value ref="value"/> 
           </xf:itemset> 
          </fr:box-select> 
         </xh:td> 
        </xh:tr> 
       </fr:grid> 
      </fr:section> 
      <fr:section id="section-7-control" bind="section-7-bind"> 
       <xf:label ref="$form-resources/section-7/label"/> 
       <fr:grid> 
        <xh:tr> 
         <xh:td> 
          <fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder" 
              xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" 
              id="control-8-control" 
              bind="control-8-bind"> 
           <xf:label ref="$form-resources/control-8/label"/> 
           <xf:hint ref="$form-resources/control-8/hint"/> 
           <xf:alert ref="$fr-resources/detail/labels/alert"/> 


          </fr:yesno-input> 
         </xh:td> 
        </xh:tr> 
       </fr:grid> 
      </fr:section> 
     </fr:body> 
    </fr:view> 
</xh:body> 
</xh:html> 

我希望再,在这个例子中,提交按钮是隐藏的,只有在所有其他部分填满时才出现在最后一部分。但是当我到达表单的结尾时,我看不到提交按钮。

No submit button there!

我也试图让只有一组按钮添加此行的属性文件:

<property as="xs:string" name="oxf.fr.detail.buttons.*.*" value="wizard-prev wizard-next submit"/> 

但“提交”按钮,在这种情况下,始终可见。

Submit always shown!

有什么我已经跳过?

回答

1

是的,这会有很大的意义。不幸的是,截至撰写本文时,这是不可能的。然而,从光明的角度来看,这是该产品的“顶级RFE”之一,所以我认为它很有可能会很快实现。如果您希望在有新情况发生时收到通知,您可以订阅issue #940: Better way to control buttons visibility/readonlyness

+1

谢谢。我会等到解决了。我非常感谢你的工作。 – JorgeHortelano

+0

似乎[Orbeon 2016.1](http://doc.orbeon.com/form-runner/feature/wizard-view.html#validated-mode)已实现此功能! – JorgeHortelano

+0

我已经用2016.1版本的经验更新了更多信息。 – JorgeHortelano

相关问题