I have a form where the user selects a radio button and selects the province, then they enter the postal code and click submit. It should then output some information. Here is the HTML:
Here is the javascript: (I've condensed the array values)
When I click the Submit button (or link, for that matter), nothing happens. I tried using debug mode but nothing happens then either. Any ideas? Or am I way off base with how ChronoForms works? I should mention that if I put all this in an HTML file, it runs correctly.
<b>Province:</b><br>
Saskatchewan<INPUT TYPE="radio" NAME="select" id="radio1" VALUE="1" ><br>
Alberta<INPUT TYPE="radio" NAME="select" id="radio2" VALUE="2" ><br>
Manitoba<INPUT TYPE="radio" NAME="select" id="radio3" VALUE="3" ><br>
Postal Code: <input type="text" name="txt1"><br>
<input type="button" value="Submit" onClick="submitForm(this.form)">
<a href="javascript:submitForm(this.form)">Submit</a>
<a href="javascript:reset()">Reset</a><br>
Here is the javascript: (I've condensed the array values)
function submitForm(form) {
var total = document.ChronoContact_Postal_Codes.txt1.value;
var totalsub = total.substr(0,3);
var codesSk=new Array();
var codesMB=new Array();
var codesAB=new Array();
codesSk[1] = "S7H - Saskatoon - Metro 1";
codesSk[2] = "S7J - Saskatoon - Metro 1";
codesSk[3] = "S7K - Saskatoon - Metro 1";
codesSk[4] = "S7N - Saskatoon - Metro 1";
codesSk[5] = "S7P - Saskatoon - Metro 1";
codesSk[6] = "S7S - Saskatoon - Metro 1";
codesSk[7] = "S7T - Saskatoon - Metro 1";
codesSk[8] = "S7V - Saskatoon - Metro 1";
codesSk[9] = "S7W - Saskatoon - Metro 1";
codesSk[10] = "S4L - Regina - Metro 2";
codesMB[1] = "R2E - Winnipeg - Metro 1";
codesMB[2] = "R2J - Winnipeg - Metro 1";
codesMB[3] = "R2M - Winnipeg - Metro 1";
codesMB[4] = "R2P - Winnipeg - Metro 1";
codesMB[5] = "R3J - Winnipeg - Metro 1";
codesMB[6] = "R3K - Winnipeg - Metro 1";
codesMB[7] = "R3P - Winnipeg - Metro 1";
codesMB[8] = "R3R - Winnipeg - Metro 1";
codesMB[9] = "R3S - Winnipeg - Metro 1";
codesMB[10] = "R3T - Winnipeg - Metro 1";
codesAB[1] = "T5A - Edmonton - Metro 1";
codesAB[2] = "T5C - Edmonton - Metro 1";
codesAB[3] = "T5K - Edmonton - Metro 1";
codesAB[4] = "T5N - Edmonton - Metro 1";
codesAB[5] = "T5R - Edmonton - Metro 1";
codesAB[6] = "T5S - Edmonton - Metro 1";
codesAB[7] = "T5T - Edmonton - Metro 1";
codesAB[8] = "T5X - Edmonton - Metro 1";
codesAB[9] = "T5Z - Edmonton - Metro 1";
codesAB[10] = "T6A - Edmonton - Metro 1";
if (document.getElementById('radio1').checked){
for (var i = 1; i < codesSk.length; i++)
{
if (totalsub == codesSk[i].substr(0,3)){
document.write(codesSk[i]);
document.write("<br />");
}
}
}
else {
if (document.getElementById('radio2').checked){
for (var i = 1; i < codesAB.length; i++)
{
if (totalsub == codesAB[i].substr(0,3)){
document.write(codesAB[i]);
document.write("<br />");
}
}
}
else {
if (document.getElementById('radio3').checked){
for (var i = 1; i < codesMB.length; i++)
{
if (totalsub == codesMB[i].substr(0,3)){
document.write(codesMB[i]);
document.write("<br />");
}
}
}
}
}
}
When I click the Submit button (or link, for that matter), nothing happens. I tried using debug mode but nothing happens then either. Any ideas? Or am I way off base with how ChronoForms works? I should mention that if I put all this in an HTML file, it runs correctly.