Difference between revisions of "Talk:SimpleForms categorisation example"
(cross browser XHR) |
m (→Category does not get added) |
||
Line 23: | Line 23: | ||
--Matt | --Matt | ||
: We need to identify what Javascript differences are causing the AJAX requests to fail depending on the browser. The new [[Extension:Selenium.php]] might be useful here for creating automated browser specific tests where a certain output is expected -See [[Special:Selenium]] --[[User:Sven|Sven]] 09:40, 13 January 2008 (NZDT) | : We need to identify what Javascript differences are causing the AJAX requests to fail depending on the browser. The new [[Extension:Selenium.php]] might be useful here for creating automated browser specific tests where a certain output is expected -See [[Special:Selenium]] --[[User:Sven|Sven]] 09:40, 13 January 2008 (NZDT) | ||
− | ::It's not a complete solution but here is a code fragment I have used to do XHR requests. I've tested it on all the major browsers and it works. Unusually the one I had the most trouble with was Safari <3. | + | ::It's not a complete solution but here is a code fragment I have used to do XHR requests. I've tested it on all the major browsers and it works. Unusually the one I had the most trouble with was Safari < 3. It has a number of reserved words that other javascript engines have no problems with. For example, if you use a variable called ''long'' it throws an error because long is used as a data type. |
<pre> | <pre> | ||
var xhr = window.XMLHttpRequest; | var xhr = window.XMLHttpRequest; | ||
Line 49: | Line 49: | ||
} | } | ||
</pre> | </pre> | ||
− | The | + | The working example can be seen on [http://www.cs.auckland.ac.nz/people/ this page]. See the ''People search'' box on the right. |
--[[User:Rob|Rob]] 10:26, 13 January 2008 (NZDT) | --[[User:Rob|Rob]] 10:26, 13 January 2008 (NZDT) |
Revision as of 21:27, 12 January 2008
Missing something?
I get
*Select category{{#dpl: namespace = Category | mode = userformat | listseparators = ,\n*%TITLE%,, }}
in the dropdown list instead of the categories. Am I missing another extension? If so, what is it? Thanks, --Paulhat 07:52, 7 July 2007 (NZST)
I found my problem. I had an old version of DPL. They've been busy. --Paulhat 08:07, 7 July 2007 (NZST)
- Yeah they're almost coming out with a new version every week! --Nad 10:03, 7 July 2007 (NZST)
Recent categories take a while to appear in the list
I've been using something like this on my test wiki. When a new category is added it takes a few pages refreshes for it to appear in the category list. Perhaps there is some caching going on. I've got the simpleform in a template that I use in the wikiskin article. --Rob 12:38, 10 October 2007 (NZDT)
- If its a big wiki it may be because the catlinks are getting updated in a job queue - I thought this only happened when over 100000 needed to be updated though... --Nad 12:44, 10 October 2007 (NZDT)
Category does not get added
When I use this example, the category does not get added. Instead, it just adds [[Category:]] even though I selected an actual category. This happens for me when I am categorizing the current page, an existing page with no existing categories, an existing page with existing categories, or a new page. Looking at your example page, it appears this is also happening. Do you have any ideas about what I might be doing wrong? Also, can you provide a referenec where I might be able to read about what is happening in the onChange part of the code? I understand the DPL query and the rest of the simple forms code, but I do not know what is going on in the onChange part of the code. Thanks --Matt
- I suspect it is a browser specific javascript issue, what browser? It just worked for me --Sven 23:06, 11 January 2008 (NZDT)
You are right. I tried it in Netscape and it worked perfectly. However, it does not work on IE6 or IE7. Any suggestions about how I can get it to work with IE?
Thanks --Matt
- We need to identify what Javascript differences are causing the AJAX requests to fail depending on the browser. The new Extension:Selenium.php might be useful here for creating automated browser specific tests where a certain output is expected -See Special:Selenium --Sven 09:40, 13 January 2008 (NZDT)
- It's not a complete solution but here is a code fragment I have used to do XHR requests. I've tested it on all the major browsers and it works. Unusually the one I had the most trouble with was Safari < 3. It has a number of reserved words that other javascript engines have no problems with. For example, if you use a variable called long it throws an error because long is used as a data type.
var xhr = window.XMLHttpRequest; function ajax(url, vars, object) { if (xhr) var http = new XMLHttpRequest(); else var http = new ActiveXObject("MSXML2.XMLHTTP.3.0"); http.open("POST", url, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); http.onreadystatechange = function(){ if (http.readyState == 4 && http.status == 200) { if (http.responseText){ object.innerHTML = http.responseText; } } } http.send(vars); }
The working example can be seen on this page. See the People search box on the right. --Rob 10:26, 13 January 2008 (NZDT)