Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for gating select element bugs #38

Merged
merged 1 commit into from Jan 3, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -77,12 +77,12 @@ private void populateChoiceStateArrays( Scriptable fromScriptableChoices, String
labels[ i ] = (String) choice.getField( "label" );
enabled[ i ] = ( (Boolean) choice.getField( "enabled" ) ).booleanValue();

canSelect = allowMultiple || !firstSelected;
selected[ i ] = canSelect && enabled[ i ] && ( (Boolean) choice.getField( "selected" ) ).booleanValue();
firstSelected = firstSelected || selected[ i ];

type[ i ] = ( (String) choice.getField( "type" ) ).equals( "group" ) ? POPUP_ITEM_TYPE_GROUP
: POPUP_ITEM_TYPE_OPTION;

canSelect = (type[ i ] != POPUP_ITEM_TYPE_GROUP) && (allowMultiple || !firstSelected);
selected[ i ] = canSelect && enabled[ i ] && ( (Boolean) choice.getField( "selected" ) ).booleanValue();
firstSelected = firstSelected || selected[ i ];
}
} catch( Exception e ) {
throw new RuntimeException( e.getMessage() );
Expand Down
Expand Up @@ -115,7 +115,7 @@ public Object getSelectedValue() {
public void fieldChanged( Field field, int arg1 ) {
for( int index = 0; index < _listItems.length; index++ ) {
if( _listItems[ index ].isSelected() ) {
_response.addElement( new Integer( index ) );
_response.addElement( new Integer( _listItems[ index ].getIndex() ) );
}
}

Expand Down