Topic: Bug submitting forms in FA 2.3.x when file field not changed
Try this:
Setup => Company Setup => Save
Even though the checkbox "Delete Company Logo" is unchecked and there is no change in the logo file that exists, the changes in other fields do not get saved and the error: The existing image could not be removed arises.
This is due to the fact that the function check_value() only checks if the checkbox element exists in the $_POST and not if it's value is set to 1 - some browsers (versions) and windows OSes tested in FA 2.3.x (test on other combinations and even in FA 2.4.x for corrections like this) need the said function in includes/ui/ui_input.inc:
function check_value($name)
{
if (!isset($_POST[$name]))
return 0;
return 1;
}
to be
function check_value($name)
{
if (!isset($_POST[$name]) || !$_POST[$name])
return 0;
return 1;
}
0 is generally evaluates false and if 1 is the value of a ticked checkbox enforced throughout FA, then a NOT check of 1 can be used.
In fact, a very thorough check to accomodate unlike variable type comparisions would entail:
function check_value($name)
{
if (!isset($_POST[$name]) || ($_POST[$name]+0) === 0)
return 0;
return 1;
}