Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion administrator/components/com_fields/models/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function save($data)
private function checkDefaultValue($data)
{
// Empty default values are correct
if (empty($data['default_value']))
if (empty($data['default_value']) && $data['default_value'] !== "0")
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Form/Rule/OptionsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, Registry
// Check if the field is required.
$required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required');

if (!$required && empty($value))
if (!$required && empty($value) && !($data['default_value'] !== "0"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$data is undefined here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, corrected

{
return true;
}
Expand Down