Getting the current list item of the drop-down list

Hi,

I have multiple places with the same text such as “category”. There I want to let the user select the category once from the drop-down list. The other category should get the same value.

I can do this with the user filed, however I want to limit the options by making it drop-down. Does anyone know how I can achieve this?

Regards,
Caner

Your specification is not crystal-clear. So I give a solution for what I understand. If this is not what you expect, edit your question to modify it (don’t use a comment, change your question which is editable, contrary to forum sites). And if you modify it, mention OS name, LO version and save format. Be aware that my solution is valid only when document is saved .odt.

User selects from some list a “word” to be used automatically throughout the document. If this “word” is changed, the document is updated accordingly.

You have to offer the choice at some convenient location, likely near the beginning of the document. It is up to you to decide if you do it at the first occurrence or in a “preamble part” of the document, taking care not to print this ancillary part which will show directives about how to user-configure the document.

You need to define an input list field:

  1. Insert>Field>More Fields, Functions tab
  2. select Type Input list
  3. for each list item, enter it in Item and press Add
  4. press Insert when done

To capture the selected item, create a cross-reference:

  1. select the previously create input list field
  2. Insert>Cross-reference, Cross-references tab
  3. Type Set Reference
  4. give it a Name like “category”
  5. Insert

Whenever you need the selected item from the input list, insert a cross-reference:

  1. Insert>Cross-reference, Cross-references tab
  2. Type Insert Reference
  3. Refer Using Referenced text
  4. Selection: click on the name you’ve assigned (“category” above)
  5. Insert

Hi, thank you so much!

This was what I wanted. However there is one thing I want to ask, I want to use the from drop-down (Insert drop-down list content control). Because this is read-only and can not be deleted by the user. However this is not reflected immediately in the reference.

  1. Insert>Field>More Fields, Functions tab
  2. select Type Input list

When I follow the way you suggested, that is reflected immediately but that can not be read only as far as I know. Or can it be done?

Regards,
Caner

I answered from the document designer’s point of view, not from user’s. If you want something working in read-only mode, explain the purpose of the end document and what user is supposed to do/get. I feel that the way you presented your question is not the correct way to handle your unstated problem.

I will try to be more clear.

As you can see in the below screenshot. I want to let the user select the document type. So it should be read only.

And this document kind should also be shown in another place based on the selection, as shown below.
image

So I dont want user to select two times. It should only be done from one place. And it is better to be read-only. I hope it is clearer now.

Form controls are almost pointless without database. I was thinking of text fields where you can define an input list. H>owever, I have no idea how to turn the selected item into a document variable.
input_list.odt (19.0 KB)

Is it possible to make the category read only? So the user cant delete and write their own. Then this can work perfectly for my case.

I don’t know. I’m not an advanced user of Writer. There are methods to make text snippets read-only. And I would have expected that the input list could be referenced by another text field (set once, show at multiple places).

I think a much better approach is to design various templates depending on the type of document to create (if the goal is to allow your user to create a “document”).

A template is an .ott file (not .odt, note the difference). An .ott file turns into an .odt file when opened. Thus its contents is protected and user can’t modify the template.

A template contains both the styles to be used throughout (paragraph, character, page, frame and list) and initial contents. As such, you provide a technical report template, a commercial contract template, an internal memo template, … Don’t forget to initialise your templates with a skeleton document so that your users are already guided. A frequently neglected feature is field type Placeholder. Its value is the suggested text to be typed at this location. User replaces it with actual text. Register your templates with LO (File>Templates>Manage Templates so that the choice between them is only a matter of clicking on an icon in File>New>Template.

If all your users are on the same LAN, store your templates in a shared server directory and adjust Tools>Options, LibreOffice>Paths configuration to add this server directory to the list for Templates.

Im not talking about the template. When the document is opened, the user is free to write whatever they want. I dont want this situation. Even though I create different templates, the user will still be able to change the text which I dont want.

There are no parameters in any style to make text or paragraph read-only. And even it were possible, user could enter anything and delete your initial contents. At some point you must trust your users. Explain clearly what is expected and the limits of template/computer assistance for the job to be done.

The only way to create a read-only document is to export to PDF. But document is then frozen and can’t be modified further.