Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add default value of "on" to HTML::checkboxField() and HTML::radioFie…

…ld()
  • Loading branch information...
commit a99d9a36c2cf39d574b72bfc76ca069b22243d08 1 parent cdcb91c
@haraldpdl haraldpdl authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 osCommerce/OM/Core/HTML.php
View
10 osCommerce/OM/Core/HTML.php
@@ -2,7 +2,7 @@
/**
* osCommerce Online Merchant
*
- * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
+ * @copyright Copyright (c) 2012 osCommerce; http://www.oscommerce.com
* @license BSD License; http://www.oscommerce.com/bsdlicense.txt
*/
@@ -483,6 +483,10 @@ protected static function selectionField($name, $type, $values, $default = null,
$selection_text = '';
}
+ if ( empty($selection_value) ) {
+ $selection_value = 'on';
+ }
+
$field .= '<input type="' . static::output($type) . '" name="' . static::output($name) . '"';
if ( strpos($parameters, 'id=') === false ) {
@@ -492,9 +496,7 @@ protected static function selectionField($name, $type, $values, $default = null,
$field .= ' id="' . static::output(substr($parameters, $offset+4, strpos($parameters, '"', $offset+4)-($offset+4))) . '_' . $counter . '"';
}
- if ( !is_null($selection_value) ) {
- $field .= ' value="' . static::output($selection_value) . '"';
- }
+ $field .= ' value="' . static::output($selection_value) . '"';
if ( isset($default) && (($default === true) || (!is_array($default) && ((string)$default == (string)$selection_value)) || (is_array($default) && in_array($selection_value, $default))) ) {
$field .= ' checked="checked"';
Please sign in to comment.
Something went wrong with that request. Please try again.