Personal tools

Log in

Changes

From All n One's bxp software Wixi

Jump to: navigation, search

Forms Language Bar

5,055 bytes added, 10:52, 20 August 2015
no edit summary
== Putting it together ==
 
Now we can put all the elements in place and test that they change.
 
<syntaxhighlight lang="javascript">
<script type="text/javascript" language="javascript">
function fn_LanguageChange(strLanguage){
//Page variables.
var strUsername = document.getElementById('strBEDisplayed_Username').value;
//Other page elements
var strName_Title = document.getElementById('objHeading_strCDA_782_field_0_2');
var strName_Firstname = document.getElementById('objHeading_strCDA_782_field_1_2');
var strName_Initial = document.getElementById('objHeading_strCDA_782_field_2_2');
var strName_Surname = document.getElementById('objHeading_strCDA_782_field_3_2');
var strButton_Similar = document.getElementById('btnFind_SimilarstrCDA_782_field_1_2');
var objColourList = document.getElementById('strCDA_782_field_0_7');
//List out all the items to be changed
var strOpening = document.getElementById('strOpening');
var strName = document.getElementById('strName');
var strNumber = document.getElementById('strNumber');
var strColour = document.getElementById('strColour');
 
//Now we adapt the strings for each language
if (strLanguage == 'US'){
strButton_Similar.value = 'a';
strName_Title.innerHTML = 'a';
strName_Firstname.innerHTML = 'a';
strName_Initial.innerHTML = 'a';
strName_Surname.innerHTML = 'a';
strOpening.innerHTML = 'a';
strName.innerHTML = 'a';
strNumber.innerHTML = 'a';
strColour.innerHTML = 'a';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('a text', 'a value');
}
else if (strLanguage == 'IE'){
strButton_Similar.value = 'b';
strName_Title.innerHTML = 'b';
strName_Firstname.innerHTML = 'b';
strName_Initial.innerHTML = 'b';
strName_Surname.innerHTML = 'b';
strOpening.innerHTML = 'b';
strName.innerHTML = 'b';
strNumber.innerHTML = 'b';
strColour.innerHTML = 'b';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('b text', 'b value');
}
else if (strLanguage == 'FR'){
strButton_Similar.value = 'c';
strName_Title.innerHTML = 'c';
strName_Firstname.innerHTML = 'c';
strName_Initial.innerHTML = 'c';
strName_Surname.innerHTML = 'c';
strOpening.innerHTML = 'c';
strName.innerHTML = 'c';
strNumber.innerHTML = 'c';
strColour.innerHTML = 'c';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('c text', 'c value');
}
else if (strLanguage == 'ES'){
strButton_Similar.value = 'd';
strName_Title.innerHTML = 'd';
strName_Firstname.innerHTML = 'd';
strName_Initial.innerHTML = 'd';
strName_Surname.innerHTML = 'd';
strOpening.innerHTML = 'd';
strName.innerHTML = 'd';
strNumber.innerHTML = 'd';
strColour.innerHTML = 'd';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('d text', 'd value');
}
else if (strLanguage == 'DE'){
strButton_Similar.value = 'e';
strName_Title.innerHTML = 'e';
strName_Firstname.innerHTML = 'e';
strName_Initial.innerHTML = 'e';
strName_Surname.innerHTML = 'e';
strOpening.innerHTML = 'e';
strName.innerHTML = 'e';
strNumber.innerHTML = 'e';
strColour.innerHTML = 'e';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('e text', 'e value');
}
else if (strLanguage == 'PT'){
strButton_Similar.value = 'f';
strName_Title.innerHTML = 'f';
strName_Firstname.innerHTML = 'f';
strName_Initial.innerHTML = 'f';
strName_Surname.innerHTML = 'f';
strOpening.innerHTML = 'f';
strName.innerHTML = 'f';
strNumber.innerHTML = 'f';
strColour.innerHTML = 'f';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('f text', 'f value');
}
else if (strLanguage == 'PL'){
strButton_Similar.value = 'g';
strName_Title.innerHTML = 'g';
strName_Firstname.innerHTML = 'g';
strName_Initial.innerHTML = 'g';
strName_Surname.innerHTML = 'g';
strOpening.innerHTML = 'g';
strName.innerHTML = 'g';
strNumber.innerHTML = 'g';
strColour.innerHTML = 'g';
objColourList.options.length = 0;
objColourList.options[objColourList.length] = new Option('''', '''');
objColourList.options[objColourList.length] = new Option('g text', 'g value');
}
}
</script>
</syntaxhighlight>
 
When you test you should be able to confirm the following happens.
 
 
7,528
edits