|
I think you read the documentation on the autocomplete plugin wrong. If you wish to use an Url to load the autocomplete data from, which for as far as I've been able to figure out by your sample code you are, then you should return a plain text response with one possible word per line. And keep in mind it performs a round trip to the server, which means you will need to create a script file on the server (JSP, PHP, ASPX).
Look at http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions[^]
The documentation indicates the call to the server will contain the word to autocomplete in a parameter called 'q'.
|
|
|
|
|
Thanks Gerben, I read it again and understood what u mean!!..
I was just wondering if it's possible to use a wcf with it?
Also since this wcf is being used extensively and returns an object which is a list<objectnames>
thanks,
|
|
|
|
|
hi guys,
i have six(6) select controls all with values 1-6.
when i click submit in javascript i would like to check that a
select's value has not already been selected by the other five (5) selects.
can anyone please help me how i can do this, i have tried logic after logic
and yet still no joy at all...please help me.
i tried:
var ordercntr = false;
var partial = '';
var orderfinal = new Array();
for (l = 0; l < order.length; l++) {
partial += order[l] + '~';
var d = document.getElementById(order[l]).value;
if (partial.search(d) < 1)
{
orderfinal[l] = d; ordercntr = true;
}
else
{
ordercntr = false; break;
}
}
The logic works like a charm if the selected values in the selects are in the order 1-6
But fails badly if lets say the second(2) select has the value 5(or something else other than 2)
i know i have to revisit the entire logic but i have tried and now i'm asking
for help before i try forever.
I will appreciate any help.
Morgs
|
|
|
|
|
there are several ways to do this. here are a few:
1.
compare 2 with 1; then 3 with 1 and 2; then...
2.
create a bit mask where each bit corresponds to a value (bit1=value 1, bit2=value 2, bit3= value 3,...); start at zero, then OR with the bit value, in pseudo-code bitmask=bitmask | (1<<value) and finally check the final value is what it should be: 0x7E
3.
similar to #2, use a bit mask; before ORing in a new bit, check the bit is still zero; if it isn't, there is a duplicate.
4.
same as #2 or #3, however use a string instead of a bit mask.
5.
same as #2, however use an array, have it sorted, then compare with what it should be.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi Luc,
Thanks for your suggestion, i found dodgy solution though.
1. I put all my selects ids in an array (e.g. ItemOrder)
2. i loop through the ItemOrder likse so;;
var count=0;
var isMoreThanTwo=false;
for(i=0;i<ItemOrder.length;i++)
{
var d=document.getElementById(ItemOrder[i]).value;
for(a=0;a<ItemOrder.length;a++)
{
if(d==document.getElementById(ItemOrder[i]).value)
{
count++;
}
if(count>1){isMoreThanTwo=true;break;}
}
if(isMoreThanTwo)break;
}
if(count<=1)
{
}
else
{
}
The above works like a charm, might not be the best solution but does just the trick
Thanks,
Morgs
|
|
|
|
|
that looks OK, except if(d==document.getElementById(ItemOrder[i]).value) should use a, not i.
Keeping the approach, the code can be further improved by:
- reducing the inner loop to for(a=i+1;a<ItemOrder.length;a++) ;
- dropping the count variable
- renaming the isMoreThanTwo variable to thereAreDuplicates
something along these lines:
var thereAreDuplicates=false;
for(i=0;i<ItemOrder.length;i++) {
var d=document.getElementById(ItemOrder[i]).value;
for(a=i+1;a<ItemOrder.length;a++) {
if(d==document.getElementById(ItemOrder[a]).value) thereAreDuplicates=true;
}
if(thereAreDuplicates)break;
}
.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks Luc,
that looks pretty aswell,
Oops your first comment was just a typo when i was writing at the forum
otherwise i have it correct in my code.
|
|
|
|
|
just sum six(6) select controls , and compare with (1 + 6) * 6 / 2.
equals means ok
|
|
|
|
|
{1,1,1,6,6,6} doesn't contain duplicates?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
|
I have download the package from http://jquery.com ,"jquery-ui-1[1].8.11.custom.zip" ,there
are too many different .js and .css files in it,and their names are analogous,i don't know
what should i include in my page.
For example, the file "demos\tabs\default.html" include follows files:
jquery.ui.all.css
jquery-1.5.1.js
jquery.ui.core.js
jquery.ui.widget.js
jquery.ui.tabs.js
demos.css
what's the function of these files??
|
|
|
|
|
Sounds as though you need to read the documentation and understand the tools before just jumping in an trying to use something.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Hai Experts.
i am working on the slide shows for my webapplication .i need a Vertical slide Show that moves From bottom to top For Example
http://www.accenture.com/us-en/Pages/index.aspx[^]
Here they are showing in the horizontal way i need in The Reverse order Vertical with same Bttom move up and Move down
please Help me out
Regards
venu
|
|
|
|
|
|
|
|
Hi,
I want the equivalent of System.Math.Max(System.Threading.Interlocked.Increment in Javascript.I used it in my c# project and want to reuse it in JS.
ty
|
|
|
|
|
Math.max[^]
JavaScript doesn't support threading so you will not get an exact equivalent
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
what is the fonctionality of System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1);
ty
|
|
|
|
|
|
I have a web application developed with asp.net I want to print a file with extension RTF using Java script. Can anyone help me to do that?
Thanks
|
|
|
|
|
Maybe a quick look here[^] might help...
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
i used flot juery for showing chat control . I want to draw chat with a data of around 2,00,000 ( x and y axis respectively ). i am using Asp.net c# now directly return this value for separate with comma of each data. Its take too time but chart doesnt load.
if return around 5000 (double value), its working...
Have any another method to do or take 5000 data for every request upto all...
Thanks..
|
|
|
|
|
Hi All,
I am using thickbox to display my child windows. When I goto the page to be displayed in thickbox for first time, it gives me session time out(unauthorized). but if I go to same page second time (just close and reopen) it works fine!!!
@one place this issue I am facing with IE only.(on Mozilla and Safari it's working fine) and on another page it's showing error with all browsers
Please suggest me anything I am clueless.
With Thanks & Regards
Amit Sk Sharma
|
|
|
|