On this page: Learn how to add editable form fields to code-based experience content templates so marketers can customize content in campaigns and journeys without editing code.
For both more flexibility and control over the code-based experiences, Journey Optimizer allows your development team to create JSON or HTML content templates containing specific predefined editable fields.
When creating a code-based experience, non-technical marketers can then directly edit these fields in the interface, without the need to even open the personalization editor, or to touch any other code elements in their journey or campaign.
This capability provides a simplified experience for marketing users while allowing developers more control over the code content, resulting in less room for errors.
Understand the form field syntax
To make portions of an HTML or a JSON code payload editable, you must use a specific syntax in the expression editor. This involves declaring a variable with a default value that users can override after applying the content template to their code-based experience.
For example, suppose you want to create a content template to apply it to your code-based experiences, and allow users to customize a specific color used in different locations, such as frames or buttons’ background colors.
When creating your content template, you need to declare a variable with a unique ID, for example “color”, and call it at the desired locations in the content where you want to apply this color.
When applying the content template to their content, users will be able to customize the color used wherever the variable is referenced.
Add editable fields to HTML or JSON content templates
To make some of your JSON or HTML code editable, start by creating a code-based experience content template where you can define specific form fields.
-
Create a content template and select the Code-based experience channel. Learn how to create templates
-
Select the authoring mode: HTML or JSON.
CAUTION
Changing the authoring mode will result in losing all of your current code. The code-based experiences based on this template need to use the same authoring mode. -
Open the personalization editor to edit your code content.
-
To define an editable form field, navigate to the Helper functions menu in the left navigation pane and add the inline attribute. The syntax to declare and call the variable is automatically added in your content.
-
Replace
"name"with a unique ID to identify the editable field. For example, enter “imgURL”.NOTE
The field ID must be unique and cannot contain spaces. This ID should be used everywhere in your content where you want to display the variable’s value. -
Adapt the syntax to suit your needs by adding parameters detailed in the table below:
Action Parameter Example Declare an editable field with a default value. When adding the template to your content, this default value will be used if you do not customize it. Add the default value between the inline tags. {{#inline "editableFieldID"}}default_value{{/inline}}Define a label for the editable field. This label will display in the code editor when editing the template’s fields. name="title"{{#inline "editableFieldID" name="title"}}default_value{{/inline}} -
Click Preview form fields to check how the editable form fields will display in the code-based experiences applying this template.
-
Use the
{{{name}}}syntax in your code at every place where you want to display the value of the editable field. Replacenamewith the unique ID of the field defined earlier.
-
Proceed similarly to add other editable fields, wrapping each of them with the
{{#inline}}and{{/inline}}tags. -
Edit the rest of your code as needed, including the IDs corresponding to the editable fields you defined. Learn how
-
Save your template.
Use decision policies in editable field forms
When creating a code-based experience content template, you can use a decision policy to leverage offers in your editable form fields.
-
Create a code-based experience template as described above.
-
Click Add decision policy either using the Show Decisioning icon from the right rail of the edition screen, or in the expression editor from the Decision policy section on the left menu.
Learn how to create a decision policy in this section.
-
Click the Insert policy button. The code corresponding to the decision policy is added.
-
After the
{{#each}}tag, insert the code corresponding to the editable form field(s) that you want to add, using the inline syntax described above. Replace"name"with a unique ID to identify your editable field. In this example, use “title”.
-
Click Preview form fields to check how the editable form fields will display in the code-based experiences applying this template.
-
Insert the rest of your code above the
{{/each}}tag. Use the{{{name}}}syntax in your code at every place where you want to display the value of your editable field. In this example, replacenamewith “title”.
-
Save your template.
Code examples
Below are a few examples of JSON and HTML templates, some of them including decision policies.
JSON template:
- String-type fields must be enclosed in double quotes.
- Integers or booleans must NOT be enclosed in double quotes. (See the
number_of_itemsfield in the example above.)
JSON template with decisioning:
{{#each}} block; otherwise, the code-based experience may not render the offer array correctly.{{#each}} and {{/each}} tags.HTML template:
HTML template with decisioning:
Edit form fields in a code-based experience
Now that the content template containing predefined editable form fields is created, you can build a code-based experience using this content template.
You will be able to easily edit the form fields from a code-based experience journey or campaign, without opening the personalization editor.
-
From the journey activity or the campaign edition screen, select the content template containing editable form fields. Learn how to use content templates
CAUTION
The templates available to choose are scoped to either HTML or JSON based on the channel configuration selected beforehand. Only compatible templates are displayed. -
The fields that were predefined in the selected content template are available on the right pane.
-
From the Editable form fields section, you can:
- Edit each value directly inside the editable fields, without opening the code editor.
- Click the personalization icon to edit each field using the code editor.
NOTE
In both cases, you can only edit one field at a time, and you cannot edit the rest of the code-based experience content. -
If a decision policy was added to the content template, it comes with all the attributes available in the offers catalog schema. You can edit the decision item inline or using the expression editor. You can also change or edit the decision policy from the Decisioning section in the right rail, without opening the code editor. Learn more
-
To edit the rest of the code, click the Edit code button and update your full code-based experience content, including the editable form fields. Learn more
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAdobe Journey Optimizer Roadmap Webinar - Americas & EMEA
Preview the Adobe Journey Optimizer roadmap and ask the product team questions.
Adobe Journey Optimizer Roadmap Webinar - Americas & APAC
Preview the Adobe Journey Optimizer roadmap and ask the product team questions.