Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Default selected item in dropdown?

Avatar

Level 2

Hi,

In my DropDown I have 2 items.

1
2

Now is item 1 default selected!

How default to select item 2 ?

Tnx,

Adnan

1 Accepted Solution

Avatar

Correct answer by
Level 10

Sorry we are not making good progress:

We don't use Web DynPro, so can't advise there. It looks like you might be deploying / using the form in HTML (instead of Acrobat/Reader); this might be affecting the dropdown.

We also use dynamic dropdown lists with SQL, like you have shown. However we can script for the default value, so I don't know why you can't achieve a similar result.

Sorry,

Niall

View solution in original post

9 Replies

Avatar

Level 10

Hi,

If I understand you correctly, you want the user to see "2" automatically pre-populated in the dropdown when they open the form.

If you select the dropdown and go to the Object / Value tab; you can select the default value:

Good luck,

N.

Avatar

Level 2

Hi Niall,

Dropdown is filled/populated dinamicly from WD.

So I would have to use javascript, I think.

Avatar

Level 10

Hi,

Try the following javascript in the initialise event of the drop down:

this.rawValue = "2";

If you have a data connection, run this script after the data connection.

The initialise event fires after the data is merged. The difficulty will be if "2" changes depending on the data that is merged back into the form.

Hope that helps,

N.

Avatar

Level 2

Hi,

I allready tried that and it's not working correct.  This is what I get: First image is what I get if I put you code. Second image is what I want..:)

2.jpgpdf.jpg

Avatar

Level 10

Hi,

It works here, where we have a dropdown list that is connected to a SQL database. The database populates the items on the list and then the script assigns the particular item on the list to the value of the field. Effectively we see the second image in your post.

To achieve the first image, would need something like addItem script.

How is the dropdown populated? Is it a data connection to a database or web service call? What is WD?

Make sure the this.rawValue line is fired after the dropdown items are assigned. As a test, try using the script in an event that fires after hte form is rendered.

Good luck,

N.

Avatar

Level 2

WD = WebDynpro

I bind table items from WebDynpro with DropDown

11.jpg

Avatar

Correct answer by
Level 10

Sorry we are not making good progress:

We don't use Web DynPro, so can't advise there. It looks like you might be deploying / using the form in HTML (instead of Acrobat/Reader); this might be affecting the dropdown.

We also use dynamic dropdown lists with SQL, like you have shown. However we can script for the default value, so I don't know why you can't achieve a similar result.

Sorry,

Niall

Avatar

Level 2

Oh men, it works!

I your posted image you had by Default Binding NORMAL.

So I changed that, and it worked fine for me.

Niall O'Donovan , Tnx!