Re: [jQuery] .addOption/.removeOption broke in jq1.1?
On 09/01/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: > > Dave, > > See my most recent post. I got the source code for the select from a > different place (I searched for it in nabble, and this was the first place I > found it), > http://sam.collett.googlepages.com/addOption.html. I just > got the code from the link you provided. Let me see if that helps any. > > Chris That's an old link, I should really take it down (or at least link to the new place). This is the latest: http://www.texotela.co.uk/code/jquery/select/ and it works with 1.1a (the page uses it). ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
Dave, See my most recent post. I got the source code for the select from a different place (I searched for it in nabble, and this was the first place I found it), http://sam.collett.googlepages.com/addOption.html. I just got the code from the link you provided. Let me see if that helps any. Chris Dave Methvin wrote: As of 1.0.3 I believe you can do this with straight HTML across all browsers. $('#optionElm').append('Name'); If it doesn't work, please file a bug. I was the suspect last seen in the vicinity of that code, and it worked for me. Browser bugs have been reported here that some attributes don't carry over (in both FF and IE) when you move form-related DOM elements around. For example, I think you may need to set the selectedIndex attribute of the select to get the correct index set after appending elements; it may not pay attention to an appended option with a "selected" attribute. Similarly, I think checkboxes become unchecked when you move them in FF. We've had some threads about it but I can't find them offhand. Really, I can't see the reason why the original plugin doesn't work; I looked through the code quickly but nothing stuck out. A demo page would help. You've got the most recent version, right? http://www.texotela.co.uk/code/jquery/select/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
It only took like five minutes to switch to using .append(). In the beginning it's how I would have done it to begin with. However, the plug-in is here: http://sam.collett.googlepages.com/addOption.html and I've already written code that breaks it. Select Test Page var a = new Array; a[0] = "jQuery"; a[1] = "really"; a[2] = "rocks!";function PopulateSelect(){for(var i = 0; i < a.length; i++){ $("#MySelectID").addOption(a[i], a[i], false); } } I hadn't gotten the chance to post it on my personal site so folks could look at it, but now I'm not sure there's a need. It'd be nice if the plug-in worked too, but like you said, don't push code that you don't need down to the browser. :o) I think I'm using the plug-in in one or two more areas, but those pages have not been upgraded to jq1.1 just yet. :o) Thanks, Chris Brandon Aaron wrote: On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: Hmm... It might be trivial, but that means I have to write code that will decide if an option is selected or not rather than passing a boolean. I used to be able to do this: $("##Classification_ID").addOption("myValue", "myOptionDisplay", (a[i].toUpperCase() == "RN")); The last bit would evaluate to a true or false, and either select the option or not. It's was a handy shortcut. Well, I'll overcome it. Jörn: I was able to get a small sample to break, but since it appears that what the dev folks want is for us to .append and .prepend, I'll do that. Whatever is faster. :o) No, I just wanted to make sure you knew it was possible to do without the plugin. I would encourage you to make it as simple on yourself as possible. If you are already using the plugin, I wouldn't drop it. Sometimes, bug fixes like the select element get overlooked and I just wanted to try and spread the word. :) If you could post a link to the actual plugin, I can setup a simple test case and see if we can find the issue. -- Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
> As of 1.0.3 I believe you can do this with straight > HTML across all browsers. > $('#optionElm').append('Name'); If it doesn't work, please file a bug. I was the suspect last seen in the vicinity of that code, and it worked for me. Browser bugs have been reported here that some attributes don't carry over (in both FF and IE) when you move form-related DOM elements around. For example, I think you may need to set the selectedIndex attribute of the select to get the correct index set after appending elements; it may not pay attention to an appended option with a "selected" attribute. Similarly, I think checkboxes become unchecked when you move them in FF. We've had some threads about it but I can't find them offhand. Really, I can't see the reason why the original plugin doesn't work; I looked through the code quickly but nothing stuck out. A demo page would help. You've got the most recent version, right? http://www.texotela.co.uk/code/jquery/select/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: > > Hmm... It might be trivial, but that means I have to write code that will > decide if an option is selected or not rather than passing a boolean. > > I used to be able to do this: > $("##Classification_ID").addOption("myValue", > "myOptionDisplay", (a[i].toUpperCase() == "RN")); > > The last bit would evaluate to a true or false, and either select the > option or not. It's was a handy shortcut. Well, I'll overcome it. > > Jörn: I was able to get a small sample to break, but since it appears that > what the dev folks want is for us to .append and .prepend, I'll do that. > Whatever is faster. :o) No, I just wanted to make sure you knew it was possible to do without the plugin. I would encourage you to make it as simple on yourself as possible. If you are already using the plugin, I wouldn't drop it. Sometimes, bug fixes like the select element get overlooked and I just wanted to try and spread the word. :) If you could post a link to the actual plugin, I can setup a simple test case and see if we can find the issue. -- Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
Hmm... It might be trivial, but that means I have to write code that will decide if an option is selected or not rather than passing a boolean. I used to be able to do this: $("##Classification_ID").addOption("myValue", "myOptionDisplay", (a[i].toUpperCase() == "RN")); The last bit would evaluate to a true or false, and either select the option or not. It's was a handy shortcut. Well, I'll overcome it. Jörn: I was able to get a small sample to break, but since it appears that what the dev folks want is for us to .append and .prepend, I'll do that. Whatever is faster. :o) Thanks Brandon. Thanks Jörn. Cheers, Chris Brandon Aaron wrote: A plugin used to be necessary for something like this as IE had some problems adding html to a select element. In jQuery we were able to work around this and provide a way to add html to select elements. I think it is better to not use a plugin if you don't have too. Less code to push to the browser. You should be able to select and element like this: $('#select').append('Name'); You can also use .prepend(). -- Brandon Aaron On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: Does everyone agree that this is the best way? I figured that the plug-in was written for a reason. I picked it up early, before I knew very much jQuery, and have just kept it in my code. I did notice that the plug-in doesn't appear to be available from jQuery.com/plugins (but, then again neither is the plug-in that I wrote). So which way *should* I be trying to accomplish building my selects? One nice feature of this plug-in is the ability to pass a true or false to select the option or not. Any more thoughts? (also, I'm still trying to produce an example showing the break I'm seeing) Chris Brandon Aaron wrote: As of 1.0.3 I believe you can do this with straight HTML across all browsers. $('#optionElm').append('Name'); -- Brandon Aaron On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: Hi folks, I'm using Sam Collett's plug-in to add and remove options from a select list, and under jQuery 1.1a it breaks. for(i = 0; i < ClientData.shifts.length; i++){ $("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, ClientData.shifts[i].shiftname, false); } The above code used to work and now it doesn't. The specific error is "object doesn't support this property or method". Any ideas? Short enough, Jörn? ;o) Chris -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
A plugin used to be necessary for something like this as IE had some problems adding html to a select element. In jQuery we were able to work around this and provide a way to add html to select elements. I think it is better to not use a plugin if you don't have too. Less code to push to the browser. You should be able to select and element like this: $('#select').append('Name'); You can also use .prepend(). -- Brandon Aaron On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: > > Does everyone agree that this is the best way? I figured that the plug-in > was written for a reason. I picked it up early, before I knew very much > jQuery, and have just kept it in my code. I did notice that the plug-in > doesn't appear to be available from jQuery.com/plugins (but, then again > neither is the plug-in that I wrote). > > So which way *should* I be trying to accomplish building my selects? One > nice feature of this plug-in is the ability to pass a true or false to > select the option or not. > > Any more thoughts? (also, I'm still trying to produce an example showing > the break I'm seeing) > > Chris > > > Brandon Aaron wrote: > As of 1.0.3 I believe you can do this with straight HTML across all > browsers. > > $('#optionElm').append('Name'); > > -- > Brandon Aaron > > On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: > > > Hi folks, > > I'm using Sam Collett's plug-in to add and remove options from a select > list, and under jQuery 1.1a it breaks. > > for(i = 0; i < ClientData.shifts.length; i++){ > $("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + > ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, > ClientData.shifts[i].shiftname, false); > } > > The above code used to work and now it doesn't. The specific error is > "object doesn't support this property or method". > > Any ideas? Short enough, Jörn? ;o) > > Chris > > -- > http://www.cjordan.info > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > > > -- > http://www.cjordan.info > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
Does everyone agree that this is the best way? I figured that the plug-in was written for a reason. I picked it up early, before I knew very much jQuery, and have just kept it in my code. I did notice that the plug-in doesn't appear to be available from jQuery.com/plugins (but, then again neither is the plug-in that I wrote). So which way *should* I be trying to accomplish building my selects? One nice feature of this plug-in is the ability to pass a true or false to select the option or not. Any more thoughts? (also, I'm still trying to produce an example showing the break I'm seeing) Chris Brandon Aaron wrote: As of 1.0.3 I believe you can do this with straight HTML across all browsers. $('#optionElm').append('Name'); -- Brandon Aaron On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: Hi folks, I'm using Sam Collett's plug-in to add and remove options from a select list, and under jQuery 1.1a it breaks. for(i = 0; i < ClientData.shifts.length; i++){ $("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, ClientData.shifts[i].shiftname, false); } The above code used to work and now it doesn't. The specific error is "object doesn't support this property or method". Any ideas? Short enough, Jörn? ;o) Chris -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
lol! :o) My dev box isn't accessible to the outside world. It's a shame. I've asked several times that it be made accessible, but they won't do it. :o( Lemme see if I can get a small example together that I could put in a publicly accessible place. :o) Chris Jörn Zaefferer wrote: Christopher Jordan schrieb: Hi folks, I'm using Sam Collett's plug-in to add and remove options from a select list, and under jQuery 1.1a it breaks. for(i = 0; i < ClientData.shifts.length; i++){ $("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, ClientData.shifts[i].shiftname, false); } The above code used to work and now it doesn't. The specific error is "object doesn't support this property or method". Any ideas? Short enough, Jörn? ;o) Great! You just forgot to add a link to an example page or at least to the plugin. -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
As of 1.0.3 I believe you can do this with straight HTML across all browsers. $('#optionElm').append('Name'); -- Brandon Aaron On 1/9/07, Christopher Jordan <[EMAIL PROTECTED]> wrote: > > Hi folks, > > I'm using Sam Collett's plug-in to add and remove options from a select > list, and under jQuery 1.1a it breaks. > > for(i = 0; i < ClientData.shifts.length; i++){ >$("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + > ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, > ClientData.shifts[i].shiftname, false); > } > > The above code used to work and now it doesn't. The specific error is > "object doesn't support this property or method". > > Any ideas? Short enough, Jörn? ;o) > > Chris > > -- > http://www.cjordan.info > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] .addOption/.removeOption broke in jq1.1?
Christopher Jordan schrieb: > Hi folks, > > I'm using Sam Collett's plug-in to add and remove options from a > select list, and under jQuery 1.1a it breaks. > > for(i = 0; i < ClientData.shifts.length; i++){ > $("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + > ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, > ClientData.shifts[i].shiftname, false); > } > > The above code used to work and now it doesn't. The specific error is > "object doesn't support this property or method". > > Any ideas? Short enough, Jörn? ;o) Great! You just forgot to add a link to an example page or at least to the plugin. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] .addOption/.removeOption broke in jq1.1?
Hi folks, I'm using Sam Collett's plug-in to add and remove options from a select list, and under jQuery 1.1a it breaks. for(i = 0; i < ClientData.shifts.length; i++){ $("##Shift_ID").addOption(ClientData.shifts[i].shiftcode + "~" + ClientData.shifts[i].shiftid + "~" + ClientData.shifts[i].shiftname, ClientData.shifts[i].shiftname, false); } The above code used to work and now it doesn't. The specific error is "object doesn't support this property or method". Any ideas? Short enough, Jörn? ;o) Chris -- http://www.cjordan.info ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/