Permalink
Browse files

added removeOption method to allow removing options from a select dro…

…p down
  • Loading branch information...
1 parent 145dbd7 commit f388442b260e41d1dbe05dd6eeb5f30fb8800010 jamiesensei committed Nov 15, 2006
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/form/select.php
View
@@ -42,5 +42,26 @@ function setHelpButton($helpbuttonargs, $function='helpbutton'){
function getHelpButton(){
return $this->_helpbutton;
}
+ /**
+ * Removes an OPTION from the SELECT
+ *
+ * @param string $value Value for the OPTION to remove
+ * @since 1.0
+ * @access public
+ * @return void
+ */
+ function removeOption($value)
+ {
+ $key=array_search($value, $this->_values);
+ if ($key!==FALSE || $key!==null) {
+ unset($this->_values[$key]);
+ }
+ foreach ($this->_options as $key=>$option){
+ if ($option['attr']['value']==$value){
+ unset($this->_options[$key]);
+ return;
+ }
+ }
+ } // end func removeOption
}
?>

0 comments on commit f388442

Please sign in to comment.