I'm pretty sure this is my problem and not anything to do with chronoforms at all. Or mootools. I'm just going crazy trying to spot the problem.
I have a multi "page" form where the first div is shown to get the user's postal code, this validates on key_up and works fine in all browsers I tried. I don't see what is syntactically different between what works fine in all browsers and what makes IE throw an error.
The first one looks like this and works in every browser including IE:
As you can see, when the postal code is validated, it calls fetchmp() itself.
The second div gets shown after the mp is looked up. On FF, Konqueror and Chrome everything works fine. In IE I get Syntax Error, mootools.js line 80 char 52 and everything just stops at that point.
The url for extraid=2 does get hit (I can see it in the server logs), but then under IE everything just comes to a stop on that syntax error I can't spot anywhere. Since the url does get hit, I suppose it happens on the return, but what?? The return from extraid=2 is just the usual 'echo json_encode($data)' This is what's in $data:
I've been using it for months on and off under firefox and had no idea it was broken in any way until I tried to use it with IE. I'm hoping one of you guys is so steeped in this stuff that a quick glance at it will tell you where I messed up.
I have a multi "page" form where the first div is shown to get the user's postal code, this validates on key_up and works fine in all browsers I tried. I don't see what is syntactically different between what works fine in all browsers and what makes IE throw an error.
The first one looks like this and works in every browser including IE:
window.addEvent('domready', function() {
$('postalcode').addEvent('keyup', function() {
var postalcode_v = $('postalcode').value;
var url = window.location + '&task=extra&extraid=1&format=raw';
var jSonRequest = new Json.Remote(url, {onComplete: function(postalcode){
var el_log_res = document.getElementById('log_res');
var el_mp_info = document.getElementById('mp_info');
el_log_res.innerHTML = postalcode.log_res;
if (postalcode.log_res == 'Valid'){
el_log_res.style.color = 'green';
$('postalcode').value = postalcode.postalcode;
$('mp_info').setStyle('display', 'block');
el_mp_info.innerHTML = '<br /><hr />Fetching MP information -- Please wait...';
foo = fetchmp(postalcode.postalcode);
}
else {
el_log_res.style.color = 'red';
$('mp_info').setStyle('display', 'none');
}
}}).send({'postalcode': postalcode_v});
});
});
As you can see, when the postal code is validated, it calls fetchmp() itself.
The second div gets shown after the mp is looked up. On FF, Konqueror and Chrome everything works fine. In IE I get Syntax Error, mootools.js line 80 char 52 and everything just stops at that point.
function fetchmp(pcode) {
var url = window.location + '&task=extra&extraid=2&format=raw';
var el_mp_email = document.getElementById('mp_email');
var jSonRequest2 = new Json.Remote(url, {onComplete: function(mp_scrape){
var el_mp_info = document.getElementById('mp_info');
el_mp_info.innerHTML = mp_scrape.mpinfo;
var fname = document.getElementById('mp_fullname');
fname.innerHTML = mp_scrape.fullname;
var pmail = document.getElementById('mp_parlmail');
pmail.innerHTML = mp_scrape.parlmail;
$('email_to').value = mp_scrape.parlmail;
var prov = document.getElementById('prov');
if (mp_scrape.prov) {
prov.value = mp_scrape.prov;
}
var city = document.getElementById('ucity');
if (mp_scrape.city) {
$('ucity').value = mp_scrape.city;
}
}}).send({'mp_scrape': pcode});
}
The url for extraid=2 does get hit (I can see it in the server logs), but then under IE everything just comes to a stop on that syntax error I can't spot anywhere. Since the url does get hit, I suppose it happens on the return, but what?? The return from extraid=2 is just the usual 'echo json_encode($data)' This is what's in $data:
$data->postalcode = $postal;
$data->log_res = $pcodevalid;
if ($pcodevalid == 'Valid') {
$mpinfo = scrape_feds($postal);
$data->mpinfo = $mpinfo['html'];
$data->fullname = $mpinfo['fullname'];
$data->parlmail = $mpinfo['parlmail'];
$data->prov = $mpinfo['prov'];
$data->city = $mpinfo['city'];
} else { ...
I've been using it for months on and off under firefox and had no idea it was broken in any way until I tried to use it with IE. I'm hoping one of you guys is so steeped in this stuff that a quick glance at it will tell you where I messed up.