Toggle IDs

Navigation:  More Advanced Procedures > Toggles: Expanding Text and Images >

Toggle IDs

Previous pageReturn to chapter overviewNext page

Show/Hide Hidden Text

The toggle ID is optional and we recommend that you leave this field blank in the Insert Toggle dialog. Then Help & Manual will automatically assign a unique ID to each toggle when you publish your help. If you don't know what HTML IDs are and how they can be used you can ignore the ID field and this topic entirely you don't need to worry about it.

Click to expand/collapseWhen you need static, manually-entered IDS

You only need to enter your own ID manually if you plan to access the toggle IDs with your own code after generating your help. The automatically-assigned IDs can change every time you publish (they are based on the sequential order of the toggles on the page) and so you must enter a manual ID if you always want to have the same ID to refer to.

When you use your own IDs you have to make sure that each ID is unique in the current topic. If you use the same ID more than once in the same topic your toggles will not work properly.

Click to expand/collapseAuto-incrementing IDs for cloned and copied toggles

If you make copies of toggles containing manually-entered IDs within the same topic you must change the IDs in the copies, otherwise you will have ID conflicts. Help & Manual automatically flags copied and cloned toggles containing ID conflicts by highlighting them in red, and it will not allow you to manually enter a duplicate ID for a toggle.

If you want to clone toggles, for example by copying or with snippets, it can be annoying to have to manually edit the ID for every toggle you enter. You can get around this problem by creating an automatically-incrementing ID with text variables.

You can't mix text and variables in topic IDs so you need to create two variables to do this.

1.Go to Project Explorer > Configuration > Common Properties > Text Variables and create two text variables, one for the static part of the ID and one for the incrementing number. The static part can have any name you like, the incrementing number must have two plus characters at the end of its name, for example TOGGLLENO++.

2.Let's say the two variables are TOGGLEID and TOGGLENO++. Now enter any text you like as the text for the TOGGLEID variable, for example mytoggle_, and a 0 (the number zero) as the text for the TOGGLENO++ variable, like this (this example shows similar variables for use in tables):

table_ids

3. Then instead of an ID, type in both variables in the Optional ID: field in the Edit/Insert Toggle dialog, like this:

<%TOGGLEID%><%TOGGLENO++%>

Then every time you insert a copy of the toggle in your project a new unique ID will be generated automatically. The first will be mytoggle_1, the second will be mytoggle_2 and so on.

See also:

Editing and copying toggles

Counter variables for numbering