Form XML drives more than runtime validation. The language server reads cartridge form definitions and generates types for the native SFCC form model and SFRA's server.forms.getForm() wrapper. Field names, groups, includes, actions, and value types become part of script intelligence.
Define a small form
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.demandware.com/xml/form/2008-04-19">
<field formid="email" type="string" mandatory="true" />
<field formid="subscribe" type="boolean" />
<action formid="submit" valid-form="true" />
</form>After the form is indexed, access it through either form API:
var server = require('server');
var form = server.forms.getForm('newsletter');
var email = form.email.value;
var subscribed = form.subscribe.checked;The literal form name selects the generated SFRA shape. Field wrappers include value, valid, error, HTML names, and type-specific members such as boolean checked and selected.
<isscript>
var form = pdict.CurrentForms.newsletter;
var email = form.email.value;
var valid = form.valid;
</isscript>In a template, pdict.CurrentForms uses the generated SfccForms map. Native field members use dw.web.FormField with the declared value type. The generated form group exposes its named fields and actions. The bundled session.forms declaration is more generic; use an explicit SfccForms annotation if you need that generated shape through session.forms.
Invoke completion after form. to discover fields; hover form.email.value to inspect its type. Use Go to Definition on 'newsletter' in server.forms.getForm() or a generated field member to return to the corresponding XML.
What the generator models
| Form structure | Generated support |
|---|---|
| Named fields | Field members with the declared value type; integer and number fields map to numbers |
| Nested groups | Nested typed form groups |
| Included forms | Included structure is resolved into the form model |
| Actions | Native form actions and SFRA action properties |
| SFRA string fields | String-specific members such as minimum length, maximum length, and regular expression |
| SFRA numeric fields | Minimum and maximum value members |
| SFRA boolean fields | Checked and selected state |
Generated declarations are written to .intellij-sfcc/generated/form-types.d.ts. Edit the form XML and let the generator refresh it. Runtime form validation still depends on the deployed XML and submitted request; editor types do not simulate form submission.