PersonafileSpecification

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: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.

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.