Expand my Community achievements bar.

Populating a drop-down field with bilingual data based on form locale

Avatar

Level 1

Hello,

I'm creating a form that has several drop-down lists of values. These values are kept in an xml file that is linked to the XSD schema that we are using as the Data Connection in our form. We have not been able to figure out how to change the values displayed in the drop-down list based on the language of the form (determined by checking the Form Locale). The xml element that contains the data is a simple type. When the form is displayed, the English values appear in the drop-down, but if we change the form's locale to French, we still get the English values. I figure we need to use scripting to accomplish this, but I haven't been able to find any sample code of how to do this anywhere.

Can anyone please help me with this?

Thanks!

5 Replies

Avatar

Former Community Member

When you set up your form you bind the DDList to a set of repeatig nodes in the xml file. This binding happens when the form is loaded and cannot be changed. So the 1st set of repeating nodes will get placed in the DDList. To do this you will have ot populate the DDList yourself and then clear it and repopulate when the language changes.

Make sense?

Paul

Avatar

Level 1

It sort of makes sense. However, we can't have any values in the script to populate the dropdown; they have to come from the xml. In some cases there are lots of values and they actually come from a database and are changeable, so having hard-coded values in the French won't work. Is there some way to load all (English & French) values from the XML, and then exclude the values in the language not being used from the dropdown, using JavaScript?

BTW, the language will not be changing dynamically; the language is set within the form (one English form, one French form). It's the XML that's not changing (it will have both English & French values in it). Since I posted the message I amended my xml to contain values in both languages and they both display now, but I want to exclude the values in the language not being used.

Avatar

Former Community Member

Can you modify the XML so that the English values appear under one node and the French under a different one? If so then you can have the English form

bind to the right nodes and th eFrench one bind to the other nodes.

Paul

Avatar

Level 1

I don't have much control over the XML but I can always suggest a change if we're stuck without it. In the meantime, I'll modify the xml file and try out your idea. Thanks!

Avatar

Former Community Member

If you don't how are you going to tell which items are english and which ones are french (don't forget you are doing this programatically).

Paul