No Code Attached Yet bug
avatar Globulopolis
Globulopolis
21 Feb 2024

Can't get it to work. Or I'm wrong...

Simple field:

<field
	name="homepage"
	type="url"
	label="HOMEPAGE"
	size="30"
	filter="url"
	validate="url"
	scheme="http,https"
	required="true"
/>
  1. Validation is true if url like 123abc.
  2. Validation is false if url an empty string.

If I remove required attribute, validation did not work at all(for this field).

Setting up field attribute required(like below) in model's preprocessForm() method has no effect during validation. I do var_dump($required); here https://github.com/joomla/joomla-cms/blob/5.0-dev/libraries/src/Form/FormField.php#L1188 and it is always false.

$form->setFieldAttribute('homepage', 'required', true);

Is this the expected behavior?

avatar Globulopolis Globulopolis - open - 21 Feb 2024
avatar joomla-cms-bot joomla-cms-bot - change - 21 Feb 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Feb 2024
avatar Hackwar Hackwar - change - 26 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 26 Mar 2024

Add a Comment

Login with GitHub to post a comment