Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

Bug when setting value on a select element and the select is empty


Project:Field Plug-in
Version:0.7
Component:Code
Category:bug report
Priority:normal
Assigned:DanSwitzer2
Status:closed
Description

Hi,

This is an exeptional case, which does not happen in normal scenarios although it should be handled.

When you set Value on a select element which is empty I receive a js error.

line 313:

this[0].selected = true; // saying this[0] has no properties

as the whole select is empty this make sense.

so I suggest the following modification...
from:
if( bSelectOne && bKeepLooking ){
this[0].selected = true;
}
to:
if( bSelectOne && bKeepLooking ){
if ( this[0] ) this[0].selected = true;
}

I am not sure this is the best way to handle it.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

#1

I tested this under IE6 and FF2 and wasn't able to recreate the problem. I'll put in a check for it though.

#2

Status:active» fixed

Scrath that, I had a bug in my test code. I was able to recreate the problem and I've fixed the problem in v0.8 with:

// if a select-one box and nothing selected, then try to select the default value
if( bSelectOne && bKeepLooking && !!this[0] ){
this[0].selected = true;
}

#3

Assigned to:Anonymous» DanSwitzer2

#4

Status:fixed» closed

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.