use own code for creating checkboxes

This commit is contained in:
Uwe Steinmann 2024-04-03 09:21:24 +02:00
parent f4a44a853f
commit 7b65c50b7e

View File

@ -1216,9 +1216,29 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
case 'input':
default:
switch($value['type']) {
default:
if(!empty($value['type']) && $value['type'] == 'checkbox' && isset($value['default']) && !empty($value['name']))
case 'checkbox':
if(isset($value['default']) && !empty($value['name']))
echo '<input type="hidden" name="'.$value['name'].'" value="'.$value['default'].'" />';
echo '<label class="checkbox"><input'.
(!empty($value['type']) ? ' type="'.$value['type'].'"' : '').
(!empty($value['id']) ? ' id="'.$value['id'].'"' : '').
(!empty($value['name']) ? ' name="'.$value['name'].'"' : '').
(!empty($value['class']) ? ' class="'.$value['class'].'"' : '').
((isset($value['value']) && is_string($value['value'])) || !empty($value['value']) ? ' value="'.$value['value'].'"' : '').
(!empty($value['placeholder']) ? ' placeholder="'.$value['placeholder'].'"' : '').
(!empty($value['autocomplete']) ? ' autocomplete="'.$value['autocomplete'].'"' : '').
(isset($value['min']) ? ' min="'.$value['min'].'"' : '').
(!empty($value['checked']) ? ' checked' : '').
(!empty($value['required']) ? ' required="required"' : '');
if(!empty($value['attributes']) && is_array($value['attributes']))
foreach($value['attributes'] as $a)
echo ' '.$a[0].'="'.$a[1].'"';
echo "/>";
if(!empty($value['label']))
echo $value['label'];
echo "</label>";
break;
default:
if(!empty($value['addon']))
echo "<span class=\"input-append\">";
echo '<input'.
@ -1934,7 +1954,7 @@ $(document).ready(function() {
case SeedDMS_Core_AttributeDefinition::type_boolean:
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValue() : $attribute) : '';
$content .= "<input type=\"hidden\" name=\"".$attr_name."\" value=\"\" />";
$content .= "<input type=\"checkbox\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"1\" ".($objvalue ? 'checked' : '')." />";
$content .= "<label class=\"checkbox\"><input type=\"checkbox\" id=\"".$attr_id."\" name=\"".$attr_name."\" value=\"1\" ".($objvalue ? 'checked' : '')." /></label>";
break;
case SeedDMS_Core_AttributeDefinition::type_date:
$objvalue = $attribute ? getReadableDate((is_object($attribute) ? $attribute->getValue() : $attribute)) : '';