Changeset 243 for trunk/trax/vendor/trax
- Timestamp:
- 08/22/06 23:25:24 (6 years ago)
- Location:
- trunk/trax/vendor/trax/action_view/helpers
- Files:
-
- 2 modified
-
form_helper.php (modified) (2 diffs)
-
form_options_helper.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/action_view/helpers/form_helper.php
r233 r243 130 130 * @uses tag_name_with_index() 131 131 */ 132 function add_default_name_and_id($options) { 132 function add_default_name_and_id($options) { 133 $name_option_exists = array_key_exists('name', $options); 133 134 if(array_key_exists("index", $options)) { 134 $options[ "name"] = array_key_exists("name", $options)135 ? $options[ "name"]136 : $this->tag_name_with_index($options[ "index"]);137 $options[ "id"] = array_key_exists("id", $options)138 ? $options[ "id"]139 : $this->tag_id_with_index($options[ "index"]);140 unset($options[ "index"]);135 $options['name'] = $name_option_exists 136 ? $options['name'] 137 : $this->tag_name_with_index($options['index']); 138 $options['id'] = array_key_exists('id', $options) 139 ? $options['id'] 140 : $this->tag_id_with_index($options['index']); 141 unset($options['index']); 141 142 } elseif($this->auto_index) { 142 $options[ "name"] = array_key_exists("name", $options)143 ? $options[ "name"]143 $options['name'] = $name_option_exists 144 ? $options['name'] 144 145 : $this->tag_name_with_index($this->auto_index); 145 $options[ "id"] = array_key_exists("id", $options)146 ? $options[ "id"]146 $options['id'] = array_key_exists('id', $options) 147 ? $options['id'] 147 148 : $this->tag_id_with_index($this->auto_index); 148 149 } else { 149 $options[ "name"] = array_key_exists("name", $options)150 ? $options[ "name"]150 $options['name'] = $name_option_exists 151 ? $options['name'] 151 152 : $this->tag_name(); 152 $options[ "id"] = array_key_exists("id", $options)153 ? $options[ "id"]153 $options['id'] = array_key_exists('id', $options) 154 ? $options['id'] 154 155 : $this->tag_id(); 156 } 157 if(array_key_exists('multiple', $options) && !$name_option_exists) { 158 $options['name'] .= "[]"; 155 159 } 156 160 return $options; … … 232 236 return $this->error_wrapping( 233 237 $this->content_tag("textarea", 234 htmlspecialchars($this->value() ),238 htmlspecialchars($this->value(), ENT_COMPAT), 235 239 $options), 236 240 array_key_exists($this->attribute_name,$this->object()->errors) -
trunk/trax/vendor/trax/action_view/helpers/form_options_helper.php
r233 r243 208 208 $this->add_options( 209 209 $this->options_for_select($choices, $value), 210 $options, 211 $value), 210 $options), 212 211 $html_options), 213 212 $this->object()->errors[$this->attribute_name]); … … 237 236 $attribute_text, 238 237 $value), 239 $options, 240 $value), 238 $options), 241 239 $html_options), 242 240 $this->object()->errors[$this->attribute_name]); … … 261 259 $this->country_options_for_select($value, 262 260 $priority_countries), 263 $options, 264 $value), 261 $options), 265 262 $html_options), 266 263 $this->object()->errors[$this->attribute_name]); … … 271 268 * 272 269 * @param string 273 * @param string[] 274 * @param string 275 * @uses value() 276 */ 277 private function add_options($option_tags, $options, $value = null) { 270 * @param array 271 */ 272 private function add_options($option_tags, $options) { 278 273 if(array_key_exists("include_blank", $options) 279 274 && $options["include_blank"] == true) { 280 275 $option_tags = "<option value=\"\"></option>\n" . $option_tags; 281 276 } 282 if( empty($value) &&array_key_exists('prompt', $options)) {277 if(array_key_exists('prompt', $options)) { 283 278 $text = $options['prompt'] ? $options['prompt'] : "Please select"; 284 279 return ("<option value=\"\">$text</option>\n" . $option_tags);
