Web Hosting Talk







View Full Version : formvalidation.js causing error in IE


bambinou
04-12-2010, 10:52 AM
Hi,


Any idea how to rectify this problem please?

When I try to submit a comment on my site, there is a runtime error detected by IE but it works fine in Firebox.

IE says that the formvalidation.js file has a runtime error, I cannot find out what.

Please Help,


Thank you,


BamBam,

Here is the code:



//this function create XML HTTP Request object for ajax
function createXmlHttpRequestObject()
{
// will store the reference to the XMLHttpRequest object
var xmlHttp;
// if running Internet Explorer
if(window.ActiveXObject)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
xmlHttp = false;
}
}
// if running Mozilla or other browsers
else
{
try
{
xmlHttp = new XMLHttpRequest();
}
catch (e)
{
xmlHttp = false;
}
}
// return the created object or display an error message
if (!xmlHttp)
alert("Error creating the XMLHttpRequest object.");
else
{
//checkLogin(xmlHttp)
return xmlHttp;
}

}
var http=createXmlHttpRequestObject();
var advertisement_link_global="";
function addClickedAdvertisementDetail(banner_id,ad_id,link,type)
{
advertisement_link_global=link;
var url='add_advertise_detail_ajax.php?banner_id='+banner_id+'&ad_id='+ad_id+'&type='+type;

http.open("GET",url,true);
if(type=="Click")
{
http.onreadystatechange = handleHttpResponseAdvertisement;
}else
{
http.onreadystatechange = handleHttpResponseAdvertisementForView;
}
http.send(null);
}

function handleHttpResponseAdvertisement()
{
if(http.readyState == 4 )
{
if(http.status == 200 )
{
var res=http.responseText;
setTimeout("",2000);
window.location=advertisement_link_global;
}
else
{
//alert(http.status);
}
}
return;

}

function handleHttpResponseAdvertisementForView()
{
if(http.readyState == 4 )
{
if(http.status == 200 )
{
var res=http.responseText;
}
else
{
//alert(http.status);
}
}
return;
}

function addUserCommentAjax(start)
{
formobj=document.userComment;
var user_comment=formobj.user_comment;
var comment_user_type=formobj.comment_user_type;
var comment_user_id=formobj.comment_user_id;
var comment_artist_id=formobj.comment_artist_id;
var validationcode=formobj.validationcode;
var user_action="Add";
var url='ajax_user_comment.php';

var params = 'action='+user_action+
'&user_type='+comment_user_type.value+
'&user_id='+comment_user_id.value+
'&artist_id='+comment_artist_id.value+
'&comment='+user_comment.value+
'&validationcode='+validationcode.value+
'&start='+start;

http.open("POST",url,true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = handleHttpResponseAddUserComment;
http.send(params);
}

function handleHttpResponseAddUserComment()
{
if(http.readyState == 4 )
{
if(http.status == 200 )
{
var res=http.responseText;
document.getElementById('hid_div_user_comment').innerHTML=res;
if(eval(document.getElementById('div_error_user_comment')))
{
document.getElementById('div_comment_status_msg').innerHTML=document.getElementById('div_error_user_comment').innerHTML;
}

if(eval(document.getElementById('div_error_imageverify')))
{
//alert(document.getElementById('span_imagevarify').innerHTML);
//document.getElementById('span_imagevarify').innerHTML=document.getElementById('div_error_imageverify').innerHTML;
//alert(document.getElementById('span_imagevarify').innerHTML);
frame_img_varify.document.location.reload();
document.getElementById('div_comment_status_msg').innerHTML=document.getElementById('div_error_user_comment').innerHTML;
}else if(eval(document.getElementById('div_ajax_user_comment')))
{
if(eval(document.getElementById('span_ajx_commnet_cnt')))
{
if(eval(document.getElementById('div_comment_cnt')))
{
document.getElementById('div_comment_cnt').innerHTML=document.getElementById('span_ajx_commnet_cnt').innerHTML;
}
}
if(document.getElementById('user_comment').value != '')
{
frame_img_varify.document.location.reload();
}
document.getElementById('validationcode').value='';
document.getElementById('div_user_comments').innerHTML=document.getElementById('div_ajax_user_comment').innerHTML;
document.getElementById('user_comment').value='';
document.getElementById('div_comment_status_msg').innerHTML=document.getElementById('div_error_user_comment').innerHTML;
}
}
else
{
alert(http.status);
}
}
return;
}

andresbuzzio
04-12-2010, 02:26 PM
IE 6 is out of control and will be deprecated so no worries so much :-)

Outlaw Web Master
04-12-2010, 03:06 PM
i don't even know anyone who is still using ie6

owm

superprogram
04-12-2010, 03:13 PM
I am using IE6 but only sometimes!

bambinou
04-12-2010, 05:55 PM
Hi,

But this problem is happening with IE8, I cannot validate the form with IE 8

Palmetto Innovations
04-12-2010, 09:57 PM
A better fix for you would be to use jQuery. Pull that library in and use the $.post/$.get methods. It makes things much simpler and will do all of the same things. You just won't have to fight the activex objects associated with IE. That is your problem, btw. Hope that helps!

bambinou
04-13-2010, 08:28 AM
Hi Palmetto,

Thanks for your help,
I am not a programmer and was hoping for an easy fix.
If I add Jquery to the form I will not even know where to start.


Thanks,

BamBam

Doh004
04-13-2010, 10:33 AM
Hi Palmetto,

Thanks for your help,
I am not a programmer and was hoping for an easy fix.
If I add Jquery to the form I will not even know where to start.


Thanks,

BamBam

Than hire one.

bambinou
04-13-2010, 12:05 PM
Doh,

Money is getting tight and programmers are very expensive, this is why I can fix about 90% of all my problems using different forums, no need for a programmer for now. I will keep posting the problem in different forums, I am sure a kind person will come up with an idea. Recession means harder for everyone.


BamBam

adityamenon90
04-16-2010, 01:52 PM
Programmers are very expensive

!!!

There's a HUGE number of programmers out there, bambinou, and most are so desperate that they'll do your work for next to nothing. Just post your problem on Freelancer.com, Limeexchange.com, ODesk.com or any other such site, and you'll be assaulted with several bids trying to outplay each other.

Of course, if you have enough time to waste by posting questions around forums, bumping them, and waiting for a useful reply (one unlike mine), then you're right. But if you would rather be earning more money by simply getting this out of the way and working on something else you're actually an expert at, better post on any of the freelancer sites on the net, and get your job done, fast.

By the way, I think you would hardly spend more than 20-30 USD on a simple project like a form that needs some jQuery bells and whistles.

bambinou
04-16-2010, 02:21 PM
Hi Adityamenon90,

I wish it was that simple, I do not let freelancers work on my site as it is a company site, I am always scared people inject malicious codes, I am also scared to forget changing some of the password and then get caught, I know some people who have passed through this, I am really sorry that some freelancers do that and spoil the hard work and reputation of others but it is something that does happen and always will.
I have employed a company for 14 months on my site, this is the 3rd company, I have lost a tremendous amount of money and the site is still not finished, I just cannot be bored to redo a new contract for such small problems, I prefer to go into forums to look for answers.

I hope you understand my point.

adityamenon90
04-16-2010, 02:25 PM
I hope you understand my point.

I do now, and I think there is no other solution to your problem than what you're doing.

And I vehemently hate companies that accept work that is way out of their skill-area, and disappoint customers by taking lots of time+cash and still not delivering on the product. They suck so much because they erode customer confidence in other software companies, and thus ruin livelihoods across a spectrum...

bambinou
04-16-2010, 02:28 PM
You are dead right , this is exactly what happened to me, they took the project, asked me a bomb for it, emptied my pockets and now I am stuck..................that's why I am here :-)

adityamenon90
04-16-2010, 02:28 PM
Besides that, sorry to have gone totally off-topic in this thread, after all the time you spent, you still don't have the answer for the question you asked. I am sorry.

By the way, please post your code between code tags, so that it is more understandable, and also, please indent it properly for readability.