Platform-neutral forms
Forms are independent of APIs: a form MAY submit directly to a URL, or MAY collect values locally without calling a service. A form is a declarative specification of fields and an optional action, not an HTML document.
6.1 Form elements
<pf:form id="contact" title="Contact support" action="https://example.com/contact" method="POST">
<pf:input name="email" type="email" required="true" />
<pf:textarea name="message" required="true" />
<pf:submit label="Send" />
</pf:form>
Core child elements:
pf:input:nameREQUIRED;typedefaults totextand may betext,email,number,search, orcheckbox;labelOPTIONAL;requiredOPTIONAL boolean (trueorfalse).pf:textarea:nameREQUIRED;labelOPTIONAL;requiredOPTIONAL.pf:submit:labelOPTIONAL, defaultSubmit. Maximum onepf:submitper form in 1.0.
pf:form attributes: id OPTIONAL,
title OPTIONAL, action OPTIONAL,
method OPTIONAL. If action is omitted, the
form submits locally to the active persona/session,
with no network call. If action is present,
method defaults to GET; version 1.0 supports
only GET and POST for remote form submission.
method without action is invalid.
For remote forms, encoding defaults to
application/x-www-form-urlencoded; charset=UTF-8:
GET appends fields as query parameters, and
POST sends fields in the request body. Fields are submitted
in document order. Duplicate field names are invalid for simplicity, and
a required field must pass its declared type validation. Unknown input
types are invalid. Additional request body types (JSON, multipart) are
not specified in this version.
6.2 Renderers
The browser MAY render identical form semantics as HTML controls, Android native UI, iOS UI, CLI prompts, voice questions, or conversational interactions. UI details are implementation choices. It MUST preserve field names, data types, required constraints, selected action and method, and confirmation/validation rules across renderers.
- Web: render as native HTML controls or equivalent.
- Android: render with native views, XML-defined layouts, or Compose.
- CLI: prompt for each field, or prepare an
equivalent preview/
curlcommand for an approved HTTP submission. - Conversational: the model may help collect field values, but submission remains browser-controlled.
A local form result is delivered as structured session data to the primary persona. Submission MUST NOT imply permanent storage or onward transmission. External form submissions MUST display their destination and request confirmation; the browser MUST avoid leaking private user data to undeclared targets.
6.3 Forms and APIs can coexist without coupling
<pf:api src="./openapi.json" />
<pf:form id="preferences" title="Preferences">
<pf:input name="city" type="text" />
<pf:submit label="Continue" />
</pf:form>
Here the API describes optional capabilities; the form collects preferences for the active persona. There is no implicit API call.