Contest form
Insert an option
To insert an option like the dropdown above, you'll be adding all 3 code chunks below. The script will add your new input at the bottom of the form (right before the sign up for emails checkbox.
<script id="contestoption-insert">
$(window).ready(function() {
if ( window.location.pathname.indexOf('/pages/win-your-rent-mortgage-contest') !== -1 ) {
let contestOption = document.createElement("div");
contestOption.classList.add('form-group');
if ( $('html').attr('lang') == 'fr' ) {
contestOption.innerHTML = document.getElementById('contestoption-FR').innerHTML;
} else {
contestOption.innerHTML = document.getElementById('contestoption-EN').innerHTML;
}
var grecaptha = document.querySelector('#webcontest .g-recaptcha');
try { grecaptha.parentElement.insertBefore(contestOption, grecaptha); } catch (error) {}
}
});
</script>
English input:
<script type="text/template" id="contestoption-EN">
<label class="control-label" for="optradio">
Question<span class="required">*</span>
</label>
<select id="optradio" name="optradio" class="form-control" oninvalid="setCustomValidity('Please select an option from this list')" onchange="try{setCustomValidity('')}catch(e){}" required>
<option value="">--------SELECT ONE--------</option>
<option value="rent">Rent</option>
<option value="mortgage">Mortgage</option>
</select>
</script>
French input:
The values for the french input should be identical to the english input. Do not translate the value=""
<script type="text/template" id="contestoption-FR">
<label class="control-label" for="optradio">
Question<span class="required">*</span>
</label>
<select id="optradio" name="optradio" class="form-control" oninvalid="setCustomValidity('Veuillez sélectionner un option dans cette liste')" onchange="try{setCustomValidity('')}catch(e){}" required>
<option value="">--------SÉLECTIONNER UN--------</option>
<option value="rent">Rent</option>
<option value="mortgage">Mortgage</option>
</select>
</script>