/* Task 1 */
// In the builder form, the Dropdown values should be the ones the user is supposed to see
const dropdownValues = {
// On the left side of the colon is the field name the user sees, on the right side is the value that is saved on form submit
// To add other fields, follow the example:
// "Visible value" : "Submitted value"
"INTO Glasgow Caledonian University" : "INTO Scotland at Glasgow Caledonian Uni",
"INTO London" : "intoLondon",
"INTO University of East Anglia" : "intoAnglia",
"Yes" : "Good"
}
$.each( dropdownValues, function(visibleText, submitText){
$( "option:contains('" + visibleText + "')" ).val(submitText);
});
/* Task 2 */
// Leave all the options in the builder, then it will filter and hide on the live page the ones that are irrelevant
// Important: Below copy paste the options that SHOULD be visible in the dropdown
// All other options that are not in the list below, will be hidden on the live page
const UKuniversities = ["INTO London", "INTO Queen's University Belfast", "INTO University of East Anglia", "INTO University of Gloucestershire", "INTO Glasgow Caledonian University"];
function page_generator(inputName){
if (window.__page_generator) {
return inputName;
} else {
return base64_encode(inputName);
}
}
$('select[name="' + page_generator("INTO Centre") + '"]').children().slice(1).each(function(){
if(jQuery.inArray($(this).text(), UKuniversities) == -1) {
$(this).detach();
}
});