If you're building forms that are part of an application, you will generally be setting up forms manually and not using the Publisher forms. To do this, you need to set up formdefinition files. For a simple site, you can just set up one global formdefinition. In your siteprofile:

<apply>
  <to type="all" />
  <formdefinitions path="<path>.formdef.xml" />
</apply>

(if you need to use more than one formdefinition file, give it a name= attribute and access it using OpenForm("formdefname:formname"))

In this fields file:

<formdefinitions xmlns="http://www.webhare.net/xmlns/publisher/forms" gid="site">
  <form name="mysubmission" gid='.mysubmissionform' 
        library="mod::mymodule/webdesigns/mydesign/libs/forms.whlib" 
        objectname="MySubmissionForm">
    <page>
      ....

Create a bit of HTML/Witty to render it:

[component myform]
  <form id="myformid" class="wh-form wh-styledinput" 
          [form.formattributes]>
    [form.field1.render]
    [form.field2.render]
 
    <div class="wh-form__buttongroup">
      <button type="submit" class="wh-form__button wh-form__button--next">Submit</button>
    </div>
  </form>
[/component]

And to put it all together, get the witty data the form needs and render it:

RECORD data := [ form := this->context->GetWittyDataForForm("<formname>") 
               ];
EmbedWittyComponent("myform", data);

(and to access the form, use `this->context->OpenForm("<formname>")`

Multipage forms

[component mymultipageform]
  <form id="myformid" class="wh-form wh-styledinput" 
          [form.formattributes]>
    <div class="wh-form__page">
      [form.field1.render]
      [form.field2.render]
    </div>
   [form.formrendernav]
  </form>
[/component]

A wh:form-pageshow 

PreviousNext

Comments