Click to See Complete Forum and Search --> : OK in NS, not in IE: simple script & form
mathaba
11-04-2003, 12:30 PM
Greetings,
I have a test forum page at:
http://mathaba.net/forum/forum.shtml?x=27239
If I use Netscape, on replying to a message, it submits the new message fine and goes to the topic list. If using I.E., it sumbits the message OK but goes to an incorrect page, which seems to be some default in the data base instead. Any ideas?
The script I am using followed by form submit is:
<SCRIPT Language="JavaScript"><!--
function checkData() {
var text="";
if(!document.f.d_subject.value) {
text+="subject "
}
if (text!="") {
alert("Please, fill the field: " + text);
return false;
} return true;
} // -->
</SCRIPT>
<form name=f method=post action="/aa/filldisc.php3" onSubmit=" return checkData()">
AdamBrill
11-04-2003, 12:47 PM
Ok... Your first problem is that this forums is totally JS dependant. It wouldn't do anything for me until I turned on JS. After I did, it worked fine with every browser I tested to post except when I tried to reply, then it didn't work in IE. It still added the comment, it just didn't take me to the right page. My suggestion is that you remove the JS part so that it doesn't relie on that at all, but rather does it all with PHP. That way it will work for the 13% (http://www.thecounter.com/stats/2003/May/javas.php) of users with JS disabled.
mathaba
11-04-2003, 01:04 PM
Originally posted by AdamBrill
Ok... Your first problem is that this forums is totally JS dependant. It wouldn't do anything for me until I turned on JS. After I did, it worked fine with every browser I tested to post except when I tried to reply, then it didn't work in IE. It still added the comment, it just didn't take me to the right page. My suggestion is that you remove the JS part so that it doesn't relie on that at all, but rather does it all with PHP. That way it will work for the 13% (http://www.thecounter.com/stats/2003/May/javas.php) of users with JS disabled.
This is very helpful, thank you. However, I removed the JS and just left the rest, and it STILL comes up with an error msg in IE line 39 char 2 Object Expected, code 0 ?! AND still goes to the incorrect page...
That aside, why was the JS stopping non-enabled JS browsers from working, when it is commented out and seems to work without the JS anyway? Clearly I am missing something due to my total lack of knowledge in this area!
http://mathaba.net/forum/forum.shtml?x=27239
AdamBrill
11-04-2003, 01:23 PM
Here is some JS code that you are still using:<input type=button name=sel_ids value="Show selected" onClick=showSelectedComments() class="discbuttons">
<input type=button name=all_ids value="Show all" onClick=showAllComments() class="discbuttons">
<input type=button name=add_disc value="Add new" onClick=showAddComments() class="discbuttons">and<script Language="JavaScript"><!--
function showSelectedComments() {
var url = "http://mathaba.net/forum/forum.shtml?AA_SL_Session=7465e72a8ba6d33cdf4200e9ba2b1de6&sh_itm=f6bd2b43e8c41fb43b7f969b30c816dc&nocache=1&sel_ids=1"
var done = 0;
for (var i = 0; i < 21; i++) {
if( eval('document.forms["discusform"].c_'+i).checked) {
done = 1
url += "&ids[" + escape(eval('document.forms["discusform"].h_'+i).value) + "]=1"
}
}
url += "\#disc"
if (done == 0) {
alert (" No comment was selected" )
} else {
document.location = url
}
}
function showAllComments() {
document.location = "http://mathaba.net/forum/forum.shtml?AA_SL_Session=7465e72a8ba6d33cdf4200e9ba2b1de6&sh_itm=f6bd2b43e8c41fb43b7f969b30c816dc&nocache=1&all_ids=1#disc"
}
function showAddComments() {
document.location = "http://mathaba.net/forum/forum.shtml?AA_SL_Session=7465e72a8ba6d33cdf4200e9ba2b1de6&sh_itm=f6bd2b43e8c41fb43b7f969b30c816dc&nocache=1&add_disc=1#disc"
}
// --></SCRIPT>Without these, your code will do nothing. :)
When you try to submit a reply, you get a "object expected" error in line 39. It is because this function: return checkData() doesn't exist. ;) I don't know if that is why it isn't working right in IE, but it really should be remade so that it doesn't rely on JS anyway.
mathaba
11-04-2003, 01:40 PM
Yes indeed :)
Thanks for pointing that out. I am using a highly complicated interface for the data base where this is all done, and which is for obscure programmers, not me! It is hard to spot where everything is generated.
So, I put back that bit of JS since of course taking it out serves no purpose. I fear they designed this "discussion forum" by way of JS merely as a side product of the main thing which is a form based interface and database for news management.
I have e-mailed one of the developers anyway, hoping he may help out or do something about these errors, and thanks for pointing out where the form field error is too - I suspect that is what causes the lack of correct destination on submit in IE.
I would like to install phpBB but cannot afford the charge the ISP will make for enabling MYSQL :( so thought I would try this use of the existing news management application.
You've been very helpful - thanks!!!
AdamBrill
11-04-2003, 02:32 PM
Hmm... you need text databases, eh? Try taking a look at this thread: http://forums.webdeveloper.com/showthread.php?s=&threadid=17781&highlight=forums I think it is pretty much done, and I think it is up there for download, so you can take a look if your interested. ;)
mathaba
11-05-2003, 03:14 AM
Re the original forum which I want to get working, I found out the following:
The problem was in include/go_url.php3
in function con_url(). New version:
function con_url($Url,$Params){
list( $path,$fragment ) = explode( '#', $Url, 2 );
return $path . (strstr($path, '?') ? "&" : "?"). $Params. $fragment;
}
So I guess that will be fixed. If I get a solution on how to make the buttons work without JS, then I will just delete all JS.
Re the other thread proposed forum, I downloaded the ZIP contains one himforum.php which I uploaded to http://mathaba.net/dump/himforum.php where it brings an error message.
I don't want to go down a new route! :)
I don't believe even php is enabled or included in the services we have, as the news data base is hosted on a different server.