Ticket #552 (closed Bug: fixed)

Opened 6 months ago

Last modified 5 months ago

Forge module : checkbox bug

Reported by: bakura Owned by: Shadowhand
Priority: minor Milestone: 2.1.2
Component: Modules:Forge Version: 2.1 Release
Keywords: Cc:

Description

required validation rule failed !

cause change made to the Form_Input.php line 523:

protected function rule_required() {

if ($this->value === OR $this->value === NULL) {

$this->errorsrequired? = TRUE;

}

}

without updating the corresponding code in the Form_Checkbox line 29

public function get($key) {

if ($key == 'value') {

// Return the value if the checkbox is checked return $this->datachecked? ? $this->datavalue? : FALSE;

}

return parent::get($key);

}

the magic method return FALSE when a checkbox isn't checked... wich mean the rule_required will now always success !!!

should update line 29 with:

return $this->datachecked? ? $this->datavalue? : 'NULL';

Change History

in reply to: ↑ description   Changed 6 months ago by bakura

sorry, forget wikiformatting :P

required validation rule failed !

cause change made to the Form_Input.php line 523:

	protected function rule_required()
	{
		if ($this->value === '' OR $this->value === NULL)
		{
			$this->errors['required'] = TRUE;
		}
	}

without updating the corresponding code in the Form_Checkbox line 29

	public function __get($key)
	{
		if ($key == 'value')
		{
			// Return the value if the checkbox is checked
			return $this->data['checked'] ? $this->data['value'] : FALSE;
		}

		return parent::__get($key);
	}

the magic method return FALSE when a checkbox isn't checked... wich mean the rule_required will now always success !!!

should update line 29 with:

			return $this->data['checked'] ? $this->data['value'] : 'NULL';

  Changed 5 months ago by Shadowhand

  • status changed from new to closed
  • version changed from SVN HEAD to 2.1 Release
  • resolution set to fixed

Fixed in r2241/r2704, merged in r2705.

Note: See TracTickets for help on using tickets.