Ticket #686 (closed Patch: fixed)

Opened 4 months ago

Last modified 4 months ago

Forge: Form_Dropdown does not validates properly.

Reported by: galli Owned by: Shadowhand
Priority: minor Milestone: 2.2
Component: Modules:Forge Version: SVN HEAD
Keywords: forge dropdown Cc:

Description

Hello everybody,

I've downloaded kohana via svn (svn co http://svn.kohanaphp.com/trunk kohana) and while using Forge I found that dropdowns were not being validated. For example I added to the rules: required|valid_digit and none of this validations were taken into account.

Fortunately I have a previous version of the Forge module (from the 2.1 version of Kohana). And after taking a look at the code I found that the new Form_Dropdown.php which I downloaded from the SVN contains the following code added:

	public function validate()
	{
		// Validation has already run
		if (is_bool($this->is_valid))
			return $this->is_valid;

		// No data to validate
		if ($this->input_value() == FALSE)
			return $this->is_valid = FALSE;

		// Load the submitted value
		$this->load_value();

		// Use array_key_exists because it properly tests NULL
		return array_key_exists($this->value, $this->data['options']);
	}

After deleting the code listed above, the validation worked again as supposed.

I checked a little bit for the issue and I also found that this code shown above was added in order to solve the ticket http://trac.kohanaphp.com/ticket/609 (http://trac.kohanaphp.com/changeset/2969).

Someone has noticed this behavior with the dropdown validation too?

Thanks! Fabián E. Gallina.

PS: Sorry if i am doing something wrong while opening the ticket. This is the first bug I report.

Change History

Changed 4 months ago by Shadowhand

  • status changed from new to assigned

Changed 4 months ago by Shadowhand

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in r3257.

Note: See TracTickets for help on using tickets.