Example form template.
[Example Form] Automated Label Translation.json4.6KB
JavaScript logic.
// Listen to field change event
window.formyoula.form_fields['Select Language'].on('change', function(){
// Get value
var selected_language = window.formyoula.form_fields['Select Language'].get('value');
// Check language
if ( selected_language == 'English' ) {
// Update field labels
window.formyoula.form_fields['b1ab-f3da-165b'].set( { label: 'Text Field One' } );
window.formyoula.form_fields['4703-10ba-3a60'].set( { label: 'Text Field Two' } );
window.formyoula.form_fields['e8b5-700d-8c75'].set( { label: 'Text Field Three' } );
// Check language
} else if ( selected_language == 'Spanish' ) {
// Update field labels
window.formyoula.form_fields['b1ab-f3da-165b'].set( { label: 'Campo de texto uno' } );
window.formyoula.form_fields['4703-10ba-3a60'].set( { label: 'Campo de texto dos' } );
window.formyoula.form_fields['e8b5-700d-8c75'].set( { label: 'Campo de texto tres' } );
}
});