Skip to main content

Providing Input Fields

  • 2 minutes to read

If your template contains strings that will likely be changed after expansion, you can use Text Fields for their definition. As a result, these strings will be marked as editable after expansion.

Simple Text Field

To insert the text field into the template code, use the «Field(default_value,description)» text command, which can be inserted using the Insert a Field toolbar button.

Ext_Templates_TextFields1

Important

The Insert a Field toolbar button inserts the «Field» text command with a non-specified default value and description. You should manually add value and description into this text command.

Group of Text Fields

A template with multiple text fields acts like a form: after such a template has been expanded, CodeRush prompts an end-user to fill required text fields sequentially. To specify the first form item, use the «Caret» and «BlockAnchor» Text Commands. You can specify the final caret position using the «FinalTarget» text command, which can be inserted using the Insert a FinalTarget command toolbar button.

Ext_Templates_TextFields2

The template presented above will expand as follows.

Ext_Templates_TextFields3

When a text field is active, you can use the following keys for navigation.

Key/Shortcut Action
Enter Accepts the contents of the active text field and activates the next text field or moves the caret to the «FinalTarget» position.
Ctrl+Shift+Enter Accepts the contents of all text fields in the active document and moves the caret to the «FinalTarget» position.
Tab Activates the next text field
Shift+Tab Activates the previous text field

Text Field Containing Linked Identifier

The «Field(default_value,description)» text command has another notation, which allows you to combine text commands: «FieldStart(description)»default_value«FieldEnd». Using this notation, you can combine the linked identifier with the text field. To insert a text field containing the linked identifier, use the Insert a Link command surrounded by FieldStart and FieldEnd commands toolbar button.

Important

The Insert a Link command surrounded by FieldStart and FieldEnd commands toolbar button inserts the «FieldStart»«Link»«FieldEnd» text command with a non-specified linked identifier and description. You should manually add them into this text command.

Ext_Templates_TextFields4

The template presented above will expand as follows.

Ext_Templates_TextFields5_GIF