Setting a default value on a formula-generated choice field

Hi all. I have a document where a user selects a country from a drop down list. Once the country is selected, I have a radio button field, with the choices generated by an @dblookup for the region.

For example, if the user chooses Europe as the country, France and Spain come up as choices for Region. If Asia is chosen as country, Japan and China come up as regions.

The region choices are generated by an @DBlookup that checks another doc in the database for the most current list of countries for each region.

I want to set defaults… so that if Europe is selected, France is checked off by default. But the “default value” “event” is run at doc creation time, so I can’t put anything in there.

is there anything I can do?

Thanks!

Subject: Setting a default value on a formula-generated choice field

Perhaps this will help.

This formula will enable the user to create a (dynamic) keyword lookup based on what has been entered. The formula looks into the current database, in this case, the view “by Category” and also includes default values that will remain even if those documents were deleted.

Formula

@Trim(@Unique(@DbColumn(“”; “”; “ByCategory”; 1) : “Balanced Funds” : “Emerging Markets Equity” : “Emerging Markets Fixed Income” : “Global Equity” : “Global Fixed Income” : “International Equity”))

Subject: RE: Setting a default value on a formula-generated choice field

I think you misunderstood my question. I don’t mean that I want some default choices… I mean that, once the list of choices is generated, the first one on that list should be already selected by default. In my original example, if the user chooses Europe, and France and Spain come up, I want France to be already selected. If the user chooses Asia, and Japan and China come up, then Japan should be pre-selected for the user.

Thanks again

Subject: Try This:

Create a hidden, computed-for-display field at the top of your form (call it Countries). Make sure the form property “Generate HTML for all fields” is enabled.

The formula for the Countries field will be the @DBLookup you were using in the second keywords field.

Replace the formula in the second keywords field with only the name of the hidden field (Countries).

In the onLoad event of your form, use the following javascript:

window.document.forms[0].YourCountryListFieldName[0].checked=true;

Javascript is case-sensitive, so make sure your CountryListFieldName (whatever it is) is spelled and capitalized correctly.

Subject: Forgot to mention

On the hidden @DBLookup field, turn the multi-value property. It didn’t seem to make a difference in my tests, but you never know…

Subject: RE: Setting a default value on a formula-generated choice field

Wouldn’t you just add “France” in the default window for the Europe selection and “Japan” in the default window for Asia?

Maybe, I still don’t understand, that’s happens to me a lot!

Subject: default value, not window!

Subject: RE: Setting a default value on a formula-generated choice field

Because the choices for that field are generated by an @DBLookup. Here’s what I mean:

I have a document that lists the countries for each region.

On the doc that the user is creating, they select a region, and that does an @DBlookup to the other document to grab the list of countries.

Therefore, if the user chooses the “Europe” region, the @dblookup checks the other document and makes the choices for country “France” and “Spain”. If they choose the “Asia” region, it checks the other document and makes the choices for country “Japan” and “China”.

So, if I put “France” as the default value, if the user chooses Asia for country, the region field won’t have “France” as an option and it won’t work. Does that make sense?

Thanks!

Subject: Okay, try this.

I used two dblookups, one for the REGION and then another based on the REGION selection.

In the second dblookup, use @If(REGIONfield = “Europe”; “France”; REGIONfield = “Asia”; “Japan”; “”)

It works in my test just fine. But then again, I still my be missing the boat.

Subject: RE: Okay, try this.

thanks for all the help. What I ended up doing was using LotusScript in the OnChange event of the Region field, and that’s working. Thanks!!!