Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Aligning text in drop down list

Participant ,
Jan 12, 2018 Jan 12, 2018

Hi,

Is there anyway of Aligning text in a dropdown box such as the below,

I can do this by putting spaces in but as different letters have different character widths

its never going to be exact, but our ex-military customer wants it exact and there are 30 in the list.

Any help appreciated

Paul

BDM                       Business Development Managers

CFIN                       Central Finance

CLR                         Client Relations

TOPICS
PDF forms
5.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jan 15, 2018 Jan 15, 2018

The script will overwrite the current values in your field.

Another thing you can do is attach it to the Mouse Up event of a button field and then click that button.

When done, hide the field so that the code is still embedded in the file and can be used later on, in case the list needs to be changed.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2018 Jan 12, 2018

It can only be done using tabs, which requires using a script. Execute this code from the JS Console and it should work:

var items = [

    "BDM\t\tBusiness Development Managers",

    "CFIN\t\tCentral Finance",

    "CLR\t\tClient Relations"

];

this.getField("Dropdown1").setItems(items);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 15, 2018 Jan 15, 2018

Hi,

Thanks for the reply, I've typed this all out but not really sure where to run this from.

thanks again

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2018 Jan 15, 2018

From the JS Console. Press Ctrl+J to open it, paste the code into it, select all of it with the mouse/keyboard and then press Ctrl+Enter to run it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 15, 2018 Jan 15, 2018

Apologies for the questions, but do I take the text with spaces out of the dropdown field I had already created so the java script populates the field, or leave it, also does the script go in the bottom window of the console as this seems to be the only place I can paste it.

I've tied running it a couple of time but nothing seems to happen and there's no errors coming up.

thanks again

Paul

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2018 Jan 15, 2018

The script will overwrite the current values in your field.

Another thing you can do is attach it to the Mouse Up event of a button field and then click that button.

When done, hide the field so that the code is still embedded in the file and can be used later on, in case the list needs to be changed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 15, 2018 Jan 15, 2018
LATEST

Thanks for your help, managed to sort it

Paul

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 15, 2018 Jan 15, 2018

I would place it as a document level function so that if I needed to change the drop list I would have the code within the form.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines