<remark>Removed mandates about x- prefix in accordance with IETF BCP, and added more specific recommendations for naming of fields in XSF and non-XSF forms.</remark>
<p>XMPP extensions that reuse &xep0004;, such as &xep0045; and &xep0050;, typically need a way to gather data from both humans (using a GUI format) and computer processes (using a pre-defined but flexible format). The 'jabber:x:data' namespace provides an adequate mechanism for both of these uses, as long as computer processes can rely on the var="" names on a particular type of form. This document defines a mechanism for the ®ISTRAR; to standardize the field names in such forms, thus enabling XMPP clients to process forms as they have to this point while giving protocol authors a way to specify a mechanism for non-GUI processors to determine the semantic meanings of forms and their constituent fields.</p>
<li>If a form type is used in the context of a standards-track protocol, it should be standardized and registered; however, there is no requirement that all form types must be registered (e.g., form types used in custom applications).</li>
<li>Forms that are not directed <em>to</em> an entity must be able to traverse the entity (e.g., a form sent to a MUC room, intended for the participants of the room, and not the room itself).</li>
<li>Forms must continue to be flexible for implementations; unknown future expansion fields must not be limited.</li>
<p>Within XMPP, namespaces are used to scope data that conforms to a schema (often data that extends the core protocol in some fashion). In addition, namespaces can also provide context for the field variable names used in jabber:x:data forms and reports. This proposal makes that association explicit by defining a mechanism for linking a namespace name with a form along with the field names and types used in that form. Specifically, the namespace name is specified in the form as the value of a hidden variable called "FORM_TYPE".</p>
<li>If the field is defined by the XSF (i.e., in a XEP), the field name SHALL be determined in accordance with the usual XSF consensus process and the field MUST be registered with the XMPP Registrar.</li>
<li>If the field is defined outside the XSF, the field name SHALL follow the extension rules described below and the field MAY be registered with the XMPP Registrar.</li>
<p>For FORM_TYPEs that are not registered with the XMPP Registrar, the field name SHALL follow the extension rules described below and the field typically will not be registered with the XMPP Registrar.</p>
<p>The "namespace" of a field is assumed to be inherited from the FORM_TYPE. When an organization or project defines a field that is used in the context of a FORM_TYPE it does not manage (e.g., a non-XSF field contained in a form whose FORM_TYPE is managed by the XSF, or a third-party field contained in a form whose FORM_TYPE is managed by some other organization), the name of the field MUST be namespaced using &clark;, where the universal name portion SHOULD be a URI controlled by the extending organization or project, e.g., a field name of "{http://example.com/pubsub}time_restrictions".</p>
<p>For reasons that are lost in the mists of time, some XMPP extension protocols produced by the XSF, such as &xep0045; and &xep0060;, prefix their field names with strings like "muc#" and "pubsub#". There is no good reason to apply that convention to new XSF extensions. Indeed, there is even no good reason to apply that convention to the names of new fields defined by the XSF for those existing XSF extensions; however, the practice is harmless for those existing extensions (since a string such as "{http://jabber.org/protocol/pubsub#subscribe_authorization}pubsub#subscriber_jid" can be considered equivalent to a string such as "pubsub#subscriber_jid"), and this document does not actively recommend deprecating the convention.</p>
<pclass='box'>Note: Older versions of this specification mandated that unregistered field names had to begin with the prefix "x-". In accordance with &rfc6648;, that mandate has been removed. However, existing "x-" field names are acceptable and can be registered with the XMPP Registrar as described above.</p>
<section2topic='Uniqueness and Comparison'anchor='approach-comparison'>
<p>FORM_TYPE names, field names, and field values MUST be compared as strings. The use of URIs in FORM_TYPE names and field names is simply a recommended method for insuring uniqueness, and other such methods are acceptable (e.g., Java-like reverse domain names such as "com.example.foo").</p>
<p>These are forms with type="form" or type="result" that do not have a hidden field of name FORM_TYPE or forms with type="submit" that do not have any field of name FORM_TYPE.
<p>In the following example, the FORM_TYPE is 'http://jabber.org/protocol/pubsub', all of the fields whose names start with "pubsub#" are registered with the XMPP Registrar (see &xep0060;), and the custom "time_restrictions" field defined by the organization at example.com uses Clark Notation in the field name.</p>
<p>If the FORM_TYPE field is not hidden in a form with type="form" or type="result", it MUST be ignored as a context indicator.</p>
<p>The following example shows a user's interaction with a Multi-User Chat room in order to register with the room. Note that as per &xep0004; the form field "type" attribute may be omitted in data forms of type "submit".</p>
<p>If the FORM_TYPE field is not type="hidden" in a data form with type "form" or type "result", it does not have the special meaning defined herein. Data forms with the type "submit" are free to omit any explicit field type declaration (as per &xep0004; § 3.2), as the type is implied by the corresponding "form"-type data form. As consequence, implementations MUST treat a FORM_TYPE field without an explicit type attribute, in data forms of type "submit", as the FORM_TYPE field with the special meaning defined herein.</p>
<p>If the form is used in an IQ, the namespace of the <query/> element SHOULD match the base namespace of the FORM_TYPE. (One possible way of solving this problem would have been to reuse the <query/> tag from the IQ form of jabber:x:data within messages, but that would have meant that existing clients would not have been able to participate in these exchanges.)</p>
<p>The registrant MAY register more than one FORM_TYPE at a time, each contained in a separate <form_type/> element. The registrant MAY also register more than one field at a time, each contained in a separate <field/> child element. Registrations of new fields within an existing FORM_TYPE MUST include the full XML snippet but SHOULD NOT include the FORM_TYPE description (only the name and the XEP number or other document identifier). Note that for ease of use the format for the <field/> element in the registry submission is the same as that defined in XEP-0004; in addition, the value of the 'type' attribute MUST be one of those defined in XEP-0004.</p>
<p>In addition, a registrant MAY also register particular field option values for fields of type 'list-single' and 'list-multi'. The format for such submissions is as follows:</p>
<code><![CDATA[
<form_type>
<name>FORM_TYPE namespace or namespace derivative</name>