mardi 14 avril 2015

Language switch for form?

I have a form, which the user fills out and will produce a report. What is the best way to make it have a toggle switch from English to French and vice versa?


Here is my existing code, in english, which I will translate later once I get the toggle to work.


Thanks!



<form class="form-horizontal mrgn-lft-md">
<div class="form-group">
<input type="text" class="form-control" placeholder="Paste the Linked text Here..." id="Link" />
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Paste the Link URL Here..." id="url" />
</div>
<div class="form-group">
<select class="form-control" id="source">
<option disabled selected>choose which mailing list</option>
<option>bienfaisance</option>
<option>businesses</option>
<option>cctb</option>
<option>charities</option>
<option>cpd</option>
<option>cra_web_performance_rendement_du_web_arc</option>
<option>credit-tpstvh</option>
<option>dchdsl</option>
<option>dpe</option>
<option>eclsd</option>
<option>electronic_filing_for_businesses</option>
<option>entreprises</option>
<option>etp</option>
<option>getready</option>
<option>gst-hst_news</option>
<option>gst-hst_technical_publications</option>
<option>gsthst-credit</option>
<option>mediaroom</option>
<option>medias</option>
<option>nouvelles_tps-tvh</option>
<option>ombudsman</option>
<option>ombudsman-f</option>
<option>payroll_deductions</option>
<option>pfce</option>
<option>pfrt</option>
<option>preparezvous</option>
<option>production_electronique_entreprises</option>
<option>pubtech-impot</option>
<option>puge</option>
<option>regimes_enregistres</option>
<option>registered_plans</option>
<option>retenues_sur_la_paie</option>
<option>rsde</option>
<option>sred</option>
<option>tax-techpub</option>
<option>tvh</option>
<option>uccb</option>
<option>witb</option>
</select>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Paste the Non Linked Text Here..." id="nonlink" />
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Paste the Teaser Here..." id="teaser"/>
</div>
</form>

<h3>HTML Lyris Message</h3>
<!-- <h4>Subject</h4>
<div class="well">
<span class="linkHTML">Linked Text Goes Here</span>
</div>
<h4>body</h4> -->
<div class="well">
<code>
<br />
&lt;html&gt;
<br />
&lt;head&gt;
<br />
&lt;/head&gt;
<br />
&lt;body&gt;
<br />
&lt;p&gt;The following is now available on the website:&lt;/p&gt;
<br />
&lt;p&gt;&lt;a href="<span class="URLHTML">URL</span><span class="sourceHTML"></span>"&gt;<span class="linkHTML">Linked Text Goes Here</span>&lt;/a&gt;&nbsp;<span class="nonlinkHTML"></span>&lt;/p&gt;
<br />
&lt;p&gt;<span class="teaserHTML"></span>&lt;/p&gt;
<br />
&lt;/body&gt;
<br />
&lt;/html&gt;
</code>
<br />
</div>
<h3>Text Lyris Message</h3>
<div class="well">
<code>
<br />
The following is now available on the website:
<br />
<br />
<span class="linkHTML"></span>&nbsp;<span class="nonlinkHTML"></span>
<br />
<span class="URLHTML"></span><span class="sourceHTML"></span>
<br />
<br />
<span class="teaserHTML"></span>
</code>
<br />
</div>
<script>
$("#Link").change(function() {
var linkstr =$("#Link").val();
$(".linkHTML").text(linkstr);
});
$("#url").change(function() {
var urlstr =$("#url").val();
$(".URLHTML").text(urlstr);
});
$("#source").change(function() {
var sourcestr =$("#source").val();
if ($("#url").val().indexOf('?') > -1){
$(".sourceHTML").text('&utm_source=' + sourcestr + '&utm_medium=eml');
}
else {
$(".sourceHTML").text('?utm_source=' + sourcestr + '&utm_medium=eml');
}

});
$("#nonlink").change(function() {
var nonlinkstr =$("#nonlink").val();
$(".nonlinkHTML").text(nonlinkstr);
});
$("#teaser").change(function() {
var teaserstr =$("#teaser").val();
$(".teaserHTML").text(teaserstr);
});
</script>

Aucun commentaire:

Enregistrer un commentaire