Skip to content

Commit

Permalink
making select test check for valid options
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Goldsborough authored and Jake Goldsborough committed Mar 1, 2013
1 parent 8488a1f commit 824db5a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Oryx/UI.ts
Expand Up @@ -57,9 +57,14 @@ module Oryx {
export class Select extends Oryx.Binding.Outlet {
get_element_value (): string { return this.$element().val() }
set_element_value ( value: string ): void {
if ( value != undefined ) {
this.$element().val(value);
}
this.$element().children('option').each(function(i) {
if ( value == $(this).val() ) {
$(this).parent().val(value);
return false;
} else {
console.warn('This is not the option you\'re looking for.');
}
});
}
}
}
Expand Down

0 comments on commit 824db5a

Please sign in to comment.