joomla-framework / form Goto Github PK
View Code? Open in Web Editor NEW[DEPRECATED] Joomla Framework Form Package
License: GNU General Public License v2.0
[DEPRECATED] Joomla Framework Form Package
License: GNU General Public License v2.0
\Joomla\Form\Rule class is a base class of form validation rules like tel, email. color etc.
As it can't be instantiated, making it an abstract class is the right approach.
If we instantiated it and run test method it will always throw exception because of empty regex.
The test suite is still locked to PHPUnit versions 4.8 thru 5.3. Tests need to be refactored for PHPUnit 5.4+ support, then bumped to a ^4.8.35|^5.4.3|~6.0
and use the namespaced base classes as adopted in PHPUnit 6.
In Form::filterField method there is filter for 'int_array' which is using ArrayHelper::toInteger and to filter 'int' it is delegating to InputFilter::clean method. so if 'A1B2C3' is filtered as int then 1 is returned, but if array('A1B2C3') is filtered as int_array then array(0) is returned.
I guess this is because of different implementation of typecasting to int in "ArrayHelper::toInteger" & in "InputFilter::clean".
If we use explicit typecasting then (int) "A1B2C3" => 0, (int) "1A2B3C" => 1 . Am I correct?
At the line https://github.com/joomla-framework/form/blob/master/Form.php#L1196 we are calling Uri::root but no such method exist in \Joomla\Uri\Uri class.
Same case at Line 1217.
Integrate support for dispatching events in the Form API.
The Repeatable form field type breaks when used with User form field type
Replication steps
Example XML code
<field name="list_users"
type="Repeatable"
icon="list"
description="PLG_TINY_FIELD_TEMPLATE_FIELD_ELEMENTS_DESC"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_ELEMENTS_LABEL"
default="{'user':['']}">
<fields name="params">
<fieldset hidden="true" name="list_users_modal" repeat="true">
<field name="user_id" type="user"
label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
filter="unset" />
</fieldset>
</fields>
</field>
Expected: a repeatable field for users that would display a modal field list of selected users, which upon "adding" a user would display a modal select box of users.
Result observed: the modal select box of users does not display as a modal but replaces the existing view with a user list and no method to return to the component view after selecting a user.
The Form package should be usable without requiring all form elements be translated or the existence of the joomla/language
package in general. Refactor the package to enable its use without the Language package while still supporting native translations.
In email rule we check that if a field is not required and its value is empty then it should pass validation. But value="0" passes this validation because
empty("") => true
empty("0") => true
we should not use empty in this case. We can do the required job by writing
$value === ""
See description
One thing I'm missing since we've removed Factory from framework is passing data to Form entities (Fields and Rules), like a DIC.
Scenaraio:
one Rule I've build has an option to check for uniqueness of the value, for that I need an access to database and that's what I'd like to retrieve from container.
When building an option tag, there is code to set an attribute:
if (isset($element[$options['option.attr']]))
{
$attr = $element[$options['option.attr']];
}
https://github.com/joomla-framework/form/blob/master/src/Html/Select.php#L580
But that requires to set $options['option.attr'] which is null by default and is not possible to set to different value outside of the Select class. Or I can't see how to change it. Somebody can?
I highly recommend you update your documentation. I spent the last 2 hours researching an issue that your documentation said was correct.
Please use this for your documentation
namespace Joomla\Form;
class Field_<type> extends \Joomla\Form\Field
{
public $type = '<type>';
// Override this function
protected function getInput()
{
$class = !empty($this->class) ? $this->class : "";
return "<input class='$class' type='button' value='Agree' id='$this->id;' name='$this->name;'>";
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.