Mootools set('html',value) in IE

Hi Experts,

I have a contact form on my site that uses Mootools and an AJAX request to validate entries into a form, then, if I have an error I create elements using the mootools framework and inject the errors into the new elements.

Now, this works fine in Firefox and Chrome but not in any versions of Internet Explorer. When clicking, the following error is indicated in Internet Explorer:-

"Unknown runtime error"

I've done a fair few google searches but nothing seems to work. I've pasted the code that I'm using below. If anyone could fire some suggestions it would be appreciated.
window.addEvent('domready', function() {
		$('ajax_submit').addEvent('click', function(e){
			e.stop();
			contact_form();
		});
	});

	var ajaxbusy = false;
		
	function contact_form()
	{
		if (ajaxbusy == true) {
			alert('Sorry, the form has not completed yet');
		} else {
			var options = {};
			options['name'] = $('name').value;
			options['email'] = $('email').value;
			options['company'] = $('company').value;
			options['url'] = $('url').value;
			options['contact'] = $('contact').value;
			options['referrer'] = $('referrer').value;
			options['message'] = $('message').value;
			var request = new Request.JSON({
				url: '<?=site_url('ajax/methods/contact_form')?>',
				data: options,
				onRequest: function(instance) {
				ajaxbusy = true
				$('contact_form').addClass('hidden');
				$('ajax_spinner').removeClass('hidden');
				},
				onComplete: function(jsonObj) {
					ajaxbusy = false;
					$('ajax_spinner').addClass('hidden');
					
					if(jsonObj.type=='pass') {
						$('contact_success').removeClass('hidden');
					}
					else {
						$('contact_failure').removeClass('hidden');
						
						if($('erroritems')) {$('erroritems').dispose();}
						if($('errorback')) {$('errorback').dispose();}
						if($('errorlink')) {$('errorlink').dispose();}
						
						var errorList  = new Element('p', {id: 'erroritems'});
						errorList.inject($('contact_failure'));
						errorList.set('html',jsonObj.error);
						
						var errorBack  = new Element('p', {id: 'errorback'});
						errorBack.inject($('contact_failure'));
						
						var errorLink = new Element('a', {id: 'errorlink', href: '#'});
						errorLink.inject(errorBack);
						errorLink.set('html','&raquo; Back to Form');
						
						errorLink.addEvent('click', function(e){
							e.stop();
							$('contact_failure').addClass('hidden');
							$('contact_form').removeClass('hidden');
						});
					}
				},
				onFailure: function (instance) {
					ajaxbusy = false;
				}
			}).send();
		}
	}
</script>

Open in new window

LVL 1
EzEApostleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Avinash ZalaWeb ExpertCommented:
Try

errorList.innerHTML= jsonObj.error;


Hope this helps.
Addy

0
EzEApostleAuthor Commented:
Hey Addy,

Thanks for the suggestion, tried but returns the same results?

Cheers
0
Avinash ZalaWeb ExpertCommented:
Assign this below event without domready.

$('ajax_submit').addEvent('click', function(e){
                  e.stop();
                  contact_form();
            });


Hope this helps
Addy
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

EzEApostleAuthor Commented:
Hi Addy,

Removing the domready from the click event results in a ajax_submit is null error.

I'm pretty sure that the reason IE fails is because for some reason it doesn't like the set('html') value, same as the innerHTML statement.
0
Avinash ZalaWeb ExpertCommented:
no innerHTML works fine for me, with no problem.

Thanks
Addy
0
EzEApostleAuthor Commented:
Is that in IE? Because, it works for me in Firefox and Chrome just fine, it just doesnt seem to be setting the container html in Internet Explorer.
0
Avinash ZalaWeb ExpertCommented:
yes its works in internet explorer too.

Addy
0
EzEApostleAuthor Commented:
Would you mind showing me the code that you've implemented Addy?

Thanks
0
Avinash ZalaWeb ExpertCommented:
I have attached my one of the function:

Hope this helps.
Addy
function getCompanyData(company_name) {
	
	var req= new Request({
		url: full_url,
		method: 'post',
		data: { 'call' : 'getCompanyData', 'company_name' : company_name },
		//onRequest: loding_image(div_id),
		onComplete: function(responseText){
			$('main_table4').fade('out');
			var e= function(e){$('main_table4').innerHTML=responseText;
			}.delay(200);
			var d=function(e){$('main_table4').fade('in');
			}.delay(1000);
		//$('main_table4').fade.delay(1000,'','in');
		}
	}).send();			
	return false;
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Avinash ZalaWeb ExpertCommented:
Did this works for you???

Addy
0
EzEApostleAuthor Commented:
Im not a JS developer and by posting code that the person made as oppossed to posting a working version of my own was not really at all helpful as I still do not know the problem of my script.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.